I have the following relationship between two domain classes:
class Emp {
String name
hasMany = [itemsell:Item, itembuy:Item]
}
class Item {
String name
}
And I need to know what items are common to both collections for a given Emp (itemsell and itembuy); how can I do such iteration?
Thanks
Make these changes to the Emp class
You can then call
emp.commonItemsto get the items in common. You should addcommonItemsto thetransientslist, so that GORM understands that this is not a persistent property