I have three fields in an entity, lets say A, B and C. I am using JPA query method findByAAndBOrC
for a query. I want to find entries by A AND (B OR C)
. But I am not sure whether findByAAndBOrC
is giving A AND (B OR C)
or (A AND B) OR C
. What is the precedence order, and how to set precedence in JPA multiple query methods for a group as we do using parentheses in sql?
Asked
Active
Viewed 62 times
0

let me down slowly
- 822
- 10
- 27
-
Why not simply run the query and look at the result (or the generated SQL statement)? – Benjamin M Aug 17 '21 at 15:53
-
2Did you try the first answer (unaccepted) in this question - https://stackoverflow.com/questions/35788856/spring-data-jpa-how-to-combine-multiple-and-and-or-through-method-name? – aksappy Aug 17 '21 at 16:11
-
@aksappy I didn't check that question, thanks, it solved my issue. Should i close the question? – let me down slowly Aug 17 '21 at 16:12
-
1@please_don't_hurt It was autogenerated comment. It is created every time question is marked as "close as duplicate". – talex Aug 17 '21 at 16:28