Skip to content
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

Using same Parameter for LIKE and = the equals check will always fail [DATAJPA-1627] #1929

Closed
spring-projects-issues opened this issue Nov 8, 2019 · 4 comments
Assignees
Labels
status: superseded An issue that has been superseded by another

Comments

@spring-projects-issues
Copy link

jonasblumer opened DATAJPA-1627 and commented

Using the same parameter for an equals comparison and a LIKE comparison will always pre- and append % to the parameter making the equals comparison always fail.

@Query("SELECT * FROM User u WHERE u.name = :term OR u.username LIKE %:term%") List<Users> getUsers(final String term);

The parameter, when calling this with getUsers("Jonas") and checking SQL logging, is %Jonas%, which means the = :term check will always fail


No further details from DATAJPA-1627

@lorentzforces
Copy link

I came across this behavior recently and I'd like to contribute a fix for it (should a fix be desired). @schauder are you currently engaged on this issue, and would you mind if I took it?

@schauder
Copy link
Contributor

schauder commented Jun 7, 2021

A fix for this would be very welcome.

@gregturn
Copy link
Contributor

@lorentzforces If you're still interested, I'd suggest beginning with writing a simple test case that exposes this issue then working your way toward a solution.

@gregturn gregturn added the status: ideal-for-contribution An issue that a contributor can help us with label Sep 30, 2022
klajdipaja added a commit to klajdipaja/spring-data-jpa that referenced this issue Mar 10, 2023
klajdipaja added a commit to klajdipaja/spring-data-jpa that referenced this issue Mar 10, 2023
…eplacing the provided parameter in a StringQuery with a new name or index when the named or indexed parameter is used more then once in the query.

Closes spring-projects#1929
klajdipaja added a commit to klajdipaja/spring-data-jpa that referenced this issue Mar 10, 2023
klajdipaja added a commit to klajdipaja/spring-data-jpa that referenced this issue Mar 24, 2023
…eplacing the provided parameter in a StringQuery with a new name or index when the named or indexed parameter is used more then once in the query.

Closes spring-projects#1929
klajdipaja added a commit to klajdipaja/spring-data-jpa that referenced this issue Mar 24, 2023
…eplacing the provided parameter in a StringQuery with a new name or index when the named or indexed parameter is used more then once in the query.

Closes spring-projects#1929
@gregturn gregturn self-assigned this Jul 26, 2023
@gregturn gregturn added status: superseded An issue that has been superseded by another and removed type: bug A general bug status: ideal-for-contribution An issue that a contributor can help us with labels Jul 26, 2023
@gregturn
Copy link
Contributor

Superceded by #3041.

@gregturn gregturn closed this as not planned Won't fix, can't repro, duplicate, stale Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another
Projects
None yet
4 participants