I have a domain structure as follows
class Parent {
static hasMany = [childs:Child]
}
class Child {
int gender
string height
}
Now, I want to get a list of all parents who have a boy (gender = 1) with a size of at least 180 cm tall and a girl (gender = 2) with more than "Height 150 cm.
I tried the criteria below
def criteria = Parent.createCriteria()
def parents = criteria.list() {
childs {
and {
and {
eq("gender", 2)
ge("height", 150)
}
and {
eq("gender", 1)
le("height", 180)
}
}
}
}
}
but it returns an empty list, although there is reliable data.
source
share