1

Similar to Handle optional parameters in QueryDSL, I need to change existing Spring Query DSL methods like findByName(String name) so that the following condition is satisfied

name = :nameParam And (:ownerParam is null OR owner is null OR owner = :ownerParam)

where owner is a new column in the existing entity/table.

Following the Table 2.3. of Supported keywords inside method names

I have changed to findByNameAndOwnerOrOwnerIsNull(String nameParam, String ownerParam) for

name = :nameParam And (owner is null OR owner = :ownerParam)

Though I'm not sure about the precedence of Or, And in query DSL.

Any help on this is more than welcome.

I am using

  • spring-data-commons-1.6.3.RELEASE.jar
  • spring-data-jpa-1.4.3.RELEASE.jar
  • (i)hibernate-entitymanager-4.2.14.SP1-redhat-1.jar, (ii) hibernate-jpa-2.0-api-1.0.1.Final-redhat-2.jar offered by JBOSS EAP 6.3
Community
  • 1
  • 1
lab bhattacharjee
  • 1,617
  • 2
  • 17
  • 33

0 Answers0