Wrap Query-mapped MapSqlParameterSource in EscapingParameterSource - #2326
Open
mp911de wants to merge 3 commits into
Open
Wrap Query-mapped MapSqlParameterSource in EscapingParameterSource#2326mp911de wants to merge 3 commits into
Query-mapped MapSqlParameterSource in EscapingParameterSource#2326mp911de wants to merge 3 commits into
Conversation
We now correctly wrap `MapSqlParameterSource` in `EscapingParameterSource` to evaluate ValueFunction using LikeEscaper. Previously, we've bound the ValueEscaper.toString() as value yielding a `org.springframework.data.relational.core.query.ValueFunction$$Lambda…` bind value. Closes #2317
Simplify data access exception handling using `DataAccessUtils`. See #2317
schauder
requested changes
Jul 2, 2026
| * @author Mark Paluch | ||
| * @since 4.1.1 | ||
| */ | ||
| class EscapingParameterSource implements SqlParameterSource { |
Contributor
There was a problem hiding this comment.
We now have two EscapingParameterSource classes. That can't be good, can it?
| return new PreparedQuery(sql, new EscapingParameterSource(parameterSource, getDialect().getLikeEscaper())); | ||
| } | ||
|
|
||
| interface QueryCreator { |
Contributor
There was a problem hiding this comment.
I find the name confusing since it TAKES a Query and produces something else.
How about SqlCreator or QueryStringCreator
The main functions should renamed accordingly, or just to create
| } | ||
|
|
||
| private PreparedQuery prepareQuery(Class<?> domainType, | ||
| BiFunction<SqlGenerator, MapSqlParameterSource, String> queryCreator) { |
Contributor
There was a problem hiding this comment.
Since we have class QueryCreator around I find this parameter name confusing, since it is NOT a queryCreator. queryStringFunction maybe?.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We now correctly wrap
MapSqlParameterSourceinEscapingParameterSourceto evaluate ValueFunction using LikeEscaper. Previously, we've bound the ValueEscaper.toString() as value yielding aorg.springframework.data.relational.core.query.ValueFunction$$Lambda…bind value.Closes #2317