Find class in model with has many relation

36 views Asked by At

I have following Model:

TestProfessional { 
    static hasMany = [answers: Answer]
}
Answer { 
String answer;
}

How to find TestProfessional with answers having specified id?

1

There are 1 answers

0
changtung On

That worked:

def questions = TestProfessional.withCriteria(uniqueResult: false) {
            answers {
            inList("id", answersIds)
        }}