Grails : how to best construct a hibernate criteria builder to search 'hasMany' relationships with domain instance
问题 I am working on a grails project and would like to leverage hibernate criteria builders to search for instances of a domain object. I would like to find instances where one of the 'hasMany' relationships contains domain object with certain ids. Here is an example of what I mean. Domain Objects class Product { static hasMany = [ productOptions: ProductOption ] } class ProductOption{ Option option static belongsTo = [ product: Product ] } class Option{ String name } This is a simplified example