You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To provide SpEL support to the users most of the Spring Data projects use their own logic to parse the given query, interpret SpEL expression, replace SpEL expressions with repository specific placeholders and create parameter mapping for them with the evaluated values.
At least the providing of common SpEL expressions (like :#{#...}, ?:#{[...}}, etc.) and evaluating them to a parameter map could be done by a functionality based in Spring Data Commons.
Besides the easier maintenance of parsing and evaluating it would define the "right" placeholders that are to be used in @Query values.
To generate the repository specific placeholders a supplier function or something similar would be required to enable the replacement mechanism to generate a valid query with placeholder
Issue Links:
DATACMNS-1260 Extract EvaluationContextProvider and SPIs into dedicated package
("depends on")
DATAGRAPH-839@Query annotation should support SpEL
("is depended on by")
DATAJPA-1267 Integrate newly created API to detect SpEL expressions in repository queries
("is depended on by")
JPA supports currently the following styles of SpEL
:#{xxx} and ?#{xxx} (defined in StringQuery which mimic named and indexed parameters in NamedParameterJdbcTemplate, JPA, and plain JDBC, although the behavior is exactly the same. The expressions get replace by bind parameter which gets bound the evaluation result of the expression.
#{#entityName} this one works differently in that it does not create a bind parameter but is considered a template. i.e. the Spel Expression gets evaluated combined with the rest of the query to a new query.
xxx denotes the actual SpEL expression which might start with a # or contain just and array access like [0] thereby referencing parameters
Gerrit Meier opened DATACMNS-1258 and commented
To provide SpEL support to the users most of the Spring Data projects use their own logic to parse the given query, interpret SpEL expression, replace SpEL expressions with repository specific placeholders and create parameter mapping for them with the evaluated values.
At least the providing of common SpEL expressions (like :#{#...}, ?:#{[...}}, etc.) and evaluating them to a parameter map could be done by a functionality based in Spring Data Commons.
Besides the easier maintenance of parsing and evaluating it would define the "right" placeholders that are to be used in
@Query
values.To generate the repository specific placeholders a supplier function or something similar would be required to enable the replacement mechanism to generate a valid query with placeholder
Issue Links:
("depends on")
@Query
annotation should support SpEL("is depended on by")
("is depended on by")
Referenced from: pull request #275
The text was updated successfully, but these errors were encountered: