groovy - GORM/Grails :: possible to query based on contents of a List within the model? -


assume following:

class thing {      string name     list<string> tags      static constraints = {         name(nullable: false)         tags(nullable: false)     }  } 

i want know if possible, using gorm, run query domain instances based on values in respective lists

for instance: there dynamic gorm finders query things 'find things have tag "video" ', or 'find things name = "product1" have tag "image" '

just want know if there's nice concise way of doing grails&gorm, opposed retrieving list of things , iterating through it, finding ones have appropriate tags , adding them results list.

thanks!

one way (although not efficient!) return whole list of things eg thing.list() , filter resulting list using findall.

list results = thing.list().findall{it.tags.contains("image")}

how big list of things , associated tags be?


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -