Grails using dynamic crawlers with 3x + boolean arguments

I successfully performed a database search using this dynamic crawler from Hibernate:

def temp = User.findByNameAndStreet("name", "street")

Although I need a triple boolean argument like this:

def temp = User.findByNameAndStreetAndCity("name", "street", "city")

Any easy way to do this?

+3
source share
1 answer

Grails dynamic crawlers do not support more than two predicates. This is because it is unclear

User.findByNameAndAgeOrGender('foo', 12, 'm')

means the following:

(name == 'foo' && age == 12) || gender == 'm'

or that:

name == 'foo' && (age == 12 || gender == 'm')

Valid if predicates are always combined with Andor Or.


Update : with Grails 1.4 you can have an unlimited number of predicates if all of them are combined with AndorOr


findWhere, findAllWhere ( , ). , , , And, :

User.findAllWhere(name: "foo", age: 12, gender: 'm')
+7

All Articles