-
Notifications
You must be signed in to change notification settings - Fork 358
Add support for table name placeholder for @Query
in JDBC and R2DBC
#1856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Table-name pre-processing requires an additional step to resolve expressions inline without binding these as parameters. The table name would be rendered in its final form meaning with quotation. |
And I guess we would need to parse the whole thing first to determine, which expression we must process with inline String replacement and which become parameters. |
JPA does something along the lines of `String.replace("#{#entityName}}", …)" which is pretty isolated and it doesn't introduce much of additional injection risks. |
@mp911de Maybe I'm wrong, but in JPA the |
The actual SpEL evaluation (and parsing) for parameter values happens here: |
SpEL expressions in queries get processed in two steps: 1. First SpEL expressions outside parameters are detected and processed. This is done with a `StandardEvaluationContext` with the variables `tableName` and `qualifiedTableName` added. This step is introduced by this commit. 2. Parameters made up by SpEL expressions are processed as usual. Closes #1856 Originial pull request #1863
SpEL expressions in queries get processed in two steps: 1. First SpEL expressions outside parameters are detected and processed. This is done with a `StandardEvaluationContext` with the variables `tableName` and `qualifiedTableName` added. This step is introduced by this commit. 2. Parameters made up by SpEL expressions are processed as usual. Closes #1856 Originial pull request #1863
SpEL expressions in queries get processed in two steps: 1. First SpEL expressions outside parameters are detected and processed. This is done with a `StandardEvaluationContext` with the variables `tableName` and `qualifiedTableName` added. This step is introduced by this commit. 2. Parameters made up by SpEL expressions are processed as usual. Closes #1856 Originial pull request #1863
@Query
in JDBC and R2DBC
Hi, @mp911de! Line Expression must be |
@romych2004 Thanks for letting us know. I created a proper issue for that and resolved it right away. In the future please create a new ticket directly, because comments on closed issues easily get lost. |
@schauder ok, I'll keep that in mind, thank you |
Currently, there is no way to reference the name of the table in the SPEL expression in
@Query
. The behavior I guess should be similar to one we have now in JPA. So something like this:I think would be the way to go.
The text was updated successfully, but these errors were encountered: