Compare associations between domain objects in Grails
Posted
by user303979
on Stack Overflow
See other posts from Stack Overflow
or by user303979
Published on 2010-04-08T00:30:45Z
Indexed on
2010/04/08
0:33 UTC
Read the original article
Hit count: 304
I am not sure if I am going about this the best way, but I will try to explain what I am trying to do.
I have the following domain classes
class User { static hasMany = [goals: Goal] }
So each User has a list of Goal objects. I want to be able to take an instance of User and return 5 Users with the highest number of matching Goal objects (with the instance) in their goals list.
Can someone kindly explain how I might go about doing this?
© Stack Overflow or respective owner