Reputation: 699
I got two domains on my project, first is Applicant and other is Screening.
On Applicant I got:
On Screening I got:
Now I would like to get all applicants with age <30 and status is hired
Here my code:
def applicant = Applicant.queryForApp(params.age)
queryForApp{age->
lt('age', age)
}
However that applicants must have status is hired. I don't know how to filter that applicant with status is "Hired" because, it's on another domain class.
Any solutions will be appreciated.
Upvotes: 0
Views: 64
Reputation: 944
The following criteria should work (not tested):
List<Applicant> applicants = Screening.withCriteria {
eq 'status', 'HIRED'
applicant {
lt 'age', 30
}
projections {
property 'applicant'
}
}
Upvotes: 3