Closed hyungjlee closed 3 weeks ago
Spring Data JPA doesn't generate any SQL statements, you might want to create a criteria query yourself with the given query and introspect whether the same SQL is being generated. AND has a higher precedence, partitioning IN
clauses isn't unusual.
@hyungjlee It's fixed by https://github.com/hibernate/hibernate-orm/commit/1cc94c76b9ede65001923b9611208996222a1ad3, you should upgrade your Hibernate version.
Hello.
I think I found a bug while using Spring Data JPA - query methods. I'll attach the code I wrote below, so please check it out.
I want to use only the AND condition for querying, but when the number of items in the IN clause increases, it seems like an OR condition is being added.
When I check the logs for the actual queries being executed, I can see that the OR condition is being appended. This is causing unintended results to be displayed.
It seems like this problem occurs because of the number of items in the IN clause. When the number exceeds a certain limit (probably 1000?), it seems to split the query with OR conditions. It looks like the query needs to be modified by adding parentheses for proper separation. Alternatively, it would be fine to throw an exception if the number exceeds 1000.
here is the version I am using.
spring-data-jpa:3.0.10
spring-boot:3.0.11
kotlin 1.9.10
Please check it out. Thanks.