spring-data-jpa icon indicating copy to clipboard operation
spring-data-jpa copied to clipboard

Add Enable/disable option for Ignore case

Open mvishnumohan opened this issue 3 years ago • 4 comments

Methods like findByNameIgnoringCase is adding UPPER irrespective of db level configurations and not hitting the indexes. In the scenario, we are supporting mssql and postgres, where postgres needs UPPER in where clause to achieve IgnoreCase whereas MSSQL does not need it. The query will work but it will not hit / use the index on name. Mssql doesnot support functions in Index otherwise we could have add an index with UPPER(name).

mvishnumohan avatar Aug 10 '22 04:08 mvishnumohan

There was a similar issue reported a while ago. Not sure if it was for Spring Data JPA or JDBC. And can't find it anymore It was asking for making the function used (lower vs upper) configurable. We probably allow for three options: lower, upper, none

schauder avatar Aug 10 '22 08:08 schauder

We should also consider introducing a configuration object that can also hold the escape character.

schauder avatar Aug 29 '22 14:08 schauder

https://github.com/spring-projects/spring-data-jpa/issues/2420 is the issue where we aligned ALL querying, be it JPA or Querydsl, to use the same modifier for ignoresCase suffixes. Since Querydsl was using lower, we ensure everything else did the same.

That issue DID make a request to make this configurable. I will scan the code to see how invasive such a flag setting would be, and to see how easy it would be for Spring Boot to also access it should we apply it.

gregturn avatar Sep 20 '22 18:09 gregturn

@gregturn that issue is where you said you would do that. But the associated commits did not appear to do that. It didn't add any tests to confirm it either.

OrangeDog avatar Feb 15 '24 15:02 OrangeDog