gorm - Errors trying to search a many to many relationship in grails -


i'm having trouble contructing query within many many relationship... have these domain classes:

class event {  appuser creator static belongsto = appuser static hasmany = [guests: appuser] 

and

class appuser {   static hasmany = [friends: appuser, events: event] 

so idea user can have friends, , can set , own multiple events, , can guests of other user's events.

my issue constructing query list of guests particular event...

i've tried in controller:

def guests = appuser.findallbyevent(eventinstance) 

this gives error

no property found name [event] class

def guests = appuser.findallbyevents(eventinstance) 

this gives error

no value specified parameter 1

any ideas how remedy? thanks.

appuser.findallbyevent doesn't make sense because there's no event property in class. dynamic finders can work persistent properties. findallbyevents more work because there events property (added ast transform because of hasmany) can't query on collections dynamic finders; need use criteria/where/hql queries those.

but don't need query @ - use hasmany property declared:

event eventinstance = ... def guests = eventinstance.guests