grails - How to compare collection item using createCriteria? -
registration domain has collection of discounts.
static hasmany = [ discounts: discount]
i want extract registrations have particular discount applied.
in following code want registrations collection has discount of id disid. how can achieve that? appreciate help!
def disid = discount.get(1).id def regs = registration.createcriteria().list(){ eq('compositeevent', cod.compositeevent) }
try this:
def disid = discount.get(1).id def regs = registration.withcriteria() { discounts { eq 'id', disid } }
see http://emmanuelrosa.com/articles/gorm-for-sqladdicts-where-clause/
Comments
Post a Comment