I'm having trouble selecting items from a list of domain objects based on a value in an enum list.
My domain object looks like this:
class Truck {
static hasMany = [ makes: Make ]
}
where a Make looks like this:
enum Make {
KENWORTH, MACK, VOLVO
}
I'm not really sure how do something like Truck.findByMake(Make.MACK) to give me all of the Trucks that have this Make in their list of Makes. That call gives me this error:
No property found for name [make] for class [class Truck]
Any ideas? Grails 1.2.2.
This one's tricky and not supported by the dynamic finders. I also don't know how to do this with Criteria queries, but the HQL would be
You can make ist with criteria query the answer is her in the forum but you have to customize it. Maybe like this:
I think each Enum has the attribute name.