Spring Boot: Custome @Query with 2 consecutive brackets cause that one pair is ignored

Viewed 1178

In my JpaRepository I have following @Query:

@Query("SELECT m FROM Msg m WHERE ((m.from = ?1 AND m.to = ?2) OR (m.from = ?2 AND m.to = ?1))  AND m.time = ?3")
Msg find(String firstId, String secondId, long lastAccess);

however in log console is this query logged without the upper brackets and it seems that is executed that way:

SELECT m FROM Msg m WHERE (m.from = ?1 AND m.to = ?2) OR (m.from = ?2 AND m.to = ?1)  AND m.time = ?3

So how to properly add multiple consecutive brackets?


I use:

Derby

Spring Boot 1.4.3.RELEASE

1 Answers
Related