java - Grails query association problem -


I'm having trouble writing a question for the following domain classes:

  class Person {Static hasMany = [membership: membership]} class membership {static status = [person: person, group: group] date included date = new date (); Group group; Person person } Class group {stable [subscription: subscription]}  

Actually, I want to meet all the people who belong to the list of groups (let's group IDs (1 , 2) The trick here is that the person should be a member of both groups. I prefer a criterion query, but the HQL is also OK.

Note that something like Group.id (1,2) will not work because it can be in any group, both .

This is my normal HCl approach:

  person.excut ("person From x where x (Select m.person membership meter WHERE to m.group =: Group 1) and in X (Subscription M. WHERE m.group =: Select from Group 2) ", [Group 1: Group.Jet (1), Group 2: Group.Jet (2)]  

Cheers


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -