Skip to content

Ambiguous query generation with null-valued parameters in like-queries #2653

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

Closed
yura2201 opened this issue Oct 3, 2022 · 4 comments
Closed
Assignees

Comments

@yura2201
Copy link

yura2201 commented Oct 3, 2022

Problem


Actually the issue 2548 has not been completely resolved!
PersistenceProvider#condense(Object) returns an empty string, so then the query
@Query(SELECT t FROM My_Table t WHERE (:param is NULL or t.attr LIKE %:param%))
will transform into select my_table.id, ..., my_table.attr as attrN from my_table where '%%' is null or my_table.attr like '%%' whereas in spring-data-jpa 2.6.4 or earlier it will transform to select my_table.id, ..., my_table.attr as attrN from my_table where NULL is null or my_table.attr like NULL

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 3, 2022
yura2201 added a commit to yura2201/spring-data-jpa that referenced this issue Oct 3, 2022
gregturn added a commit that referenced this issue Nov 7, 2022
@gregturn gregturn added this to the 3.0 GA (2022.0.0) milestone Nov 9, 2022
gregturn added a commit that referenced this issue Nov 9, 2022
@gregturn
Copy link
Contributor

gregturn commented Nov 9, 2022

Backported to 2.7.x.

@gregturn
Copy link
Contributor

gregturn commented Nov 9, 2022

@yura2201 Feel free to test out the snapshots.

@yura2201
Copy link
Author

@gregturn hey! it looks good, but I didn't succeed to find a proper snapshot in a snapshot-repo for 2.7.x

@gregturn
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants