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

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -