You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow configuration of transformation for case-insensitive queries #2420
We use Spring Data JPA + Querydsl JPA. If we perform queries with ignoreCase keyword in repository methods Spring data JPA use UPPER function on parameters in SQL(as described in documentation, Table 3. Supported keywords inside method names), but Querydsl JPA uses LOWER function. We should use two types of indexes or don't use ignoreCase keyword in repository methods.
It would be great, if it was possible to configured to use UPPER function or LOWER function in Spring Data JPA.
I ran into the same problem in the query by example code. It also appears to be hard-coded to use a lower conversion. As stated above, this is challenging because I only want to maintain a single case-insensitive index on either the upper or lowercase version of certain columns.
Going consistently with lower sounds like a good way to go. Please make sure to have this change included in release notes since it might disable existing indexes and therefore cause a performance degradation when not addressed.
I am with @OrangeDog - I just wrapped up dropping an UPPER index thinking this had been resolved in 2.7.x, only to discover that a QueryDsl Repository IgnoreCase method is still generating where upper(...)=upper(?)
changed the title [-]IgnoreCase uses Upper function in repository method names and cannot be configured.[/-][+]IgnoreCase uses Upper function in repository method names and cannot be configured[/+]on Nov 22, 2024
changed the title [-]IgnoreCase uses Upper function in repository method names and cannot be configured[/-][+]Allow configuration of transformation for case-insensitive queries[/+]on Nov 22, 2024
Is there any plan to actually fix this issue as originally intended (i.e. make everything use lower)? That would be much easier than adding new configuration.
Activity
mp911de commentedon Feb 7, 2022
FTR: https://github.com/querydsl/querydsl/blob/99e3ca936f46471bc61d9af6e1a3dbb16f3f12b3/querydsl-jpa/src/main/java/com/querydsl/jpa/JPQLTemplates.java
steveratay commentedon Mar 4, 2022
I ran into the same problem in the query by example code. It also appears to be hard-coded to use a lower conversion. As stated above, this is challenging because I only want to maintain a single case-insensitive index on either the upper or lowercase version of certain columns.
See https://github.com/spring-projects/spring-data-jpa/blob/main/src/main/java/org/springframework/data/jpa/convert/QueryByExamplePredicateBuilder.java#L182.
It would be great if this were able to be customized in the ExampleMatcher methods.
gregturn commentedon Mar 18, 2022
Whereas another knob would work, I wonder if it isn't simpler to just update things to use
loweracross the board.Use 'lower' for all ignoreCase operations.
schauder commentedon Mar 22, 2022
Going consistently with
lowersounds like a good way to go. Please make sure to have this change included in release notes since it might disable existing indexes and therefore cause a performance degradation when not addressed.gregturn commentedon Mar 22, 2022
This has been merged to
mainand to3.0.x.6 remaining items
OrangeDog commentedon Feb 15, 2024
Did this get reverted, or did I miss something? According to the logged HQL, 3.2.2 is using
upperinstead oflower.Edit:
15e8e3b doesn't look right at all. All it did was change a variable name from
lowertoupper.danwatt commentedon Feb 15, 2024
I am with @OrangeDog - I just wrapped up dropping an UPPER index thinking this had been resolved in 2.7.x, only to discover that a
QueryDslRepositoryIgnoreCasemethod is still generatingwhere upper(...)=upper(?)I am on
2.7.18for this project, upgraded to 2.6.x, and was following the release notes assuming this had been fixed in 2.7: https://github.com/spring-projects/spring-data-commons/wiki/Spring-Data-2021.2-(Raj)-Release-Notes#ignorecase-operators-now-use-lower-functions-across-the-boardOrangeDog commentedon Feb 15, 2024
@danwatt QueryDSL is using
lower, repositories are usingupper. Same as described in the original issue.OrangeDog commentedon Nov 19, 2024
@gregturn @mp911de can this be reopened? It was not fixed. It looks like someone messed up resolving conflicts in the merge or something.
mp911de commentedon Nov 19, 2024
Sure. We've started exploring configuration for ignore-case transformations with https://github.com/spring-projects/spring-data-jpa/pull/3653/files#diff-fdc19ed3d18aab513d05cd0418ab02dbaa8f1bdf5f8f8574d26d1ecdd9914486
[-]IgnoreCase uses Upper function in repository method names and cannot be configured.[/-][+]IgnoreCase uses Upper function in repository method names and cannot be configured[/+][-]IgnoreCase uses Upper function in repository method names and cannot be configured[/-][+]Allow configuration of transformation for case-insensitive queries[/+]mp911de commentedon Nov 22, 2024
This change concerns:
QueryByExamplePredicateBuilderSimpleJpaRepositoryfor Sorting and predicates
OrangeDog commentedon Nov 22, 2024
Is there any plan to actually fix this issue as originally intended (i.e. make everything use
lower)? That would be much easier than adding new configuration.