Skip to content

Wrap Query-mapped MapSqlParameterSource in EscapingParameterSource - #2326

Open
mp911de wants to merge 3 commits into
mainfrom
issue/2317
Open

Wrap Query-mapped MapSqlParameterSource in EscapingParameterSource#2326
mp911de wants to merge 3 commits into
mainfrom
issue/2317

Conversation

@mp911de

@mp911de mp911de commented Jul 1, 2026

Copy link
Copy Markdown
Member

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

mp911de added 3 commits July 1, 2026 11:25
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
@mp911de mp911de added this to the 4.0.7 (2025.1.7) milestone Jul 1, 2026
@mp911de
mp911de requested a review from schauder July 1, 2026 09:59
@mp911de mp911de added the type: regression A regression from a previous release label Jul 1, 2026

@schauder schauder left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few comments.

* @author Mark Paluch
* @since 4.1.1
*/
class EscapingParameterSource implements SqlParameterSource {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now have two EscapingParameterSource classes. That can't be good, can it?

return new PreparedQuery(sql, new EscapingParameterSource(parameterSource, getDialect().getLikeEscaper()));
}

interface QueryCreator {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have class QueryCreator around I find this parameter name confusing, since it is NOT a queryCreator. queryStringFunction maybe?.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: regression A regression from a previous release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Query by Example StringMatcher binds ValueFunction instead of resolved String value

3 participants