Sunday, 15 June 2014

gorm - Grails get domain object from database based on field with type as another domain type -



gorm - Grails get domain object from database based on field with type as another domain type -

say want books authors have "john" in name. how like:

book.createcriteria().list(){ like('author.name', '%john%') }

assuming book related author should able following:

book.createcriteria().list() { author { like('name', '%john%') } }

you can read more querying associations in documentation.

grails gorm

No comments:

Post a Comment