I have two classes in Grails application ,Employee has hasMany(one To Many relations) for another class called Vote
class Employee {
String employeeName
static hasMany = [votes:Vote]
}
and vote class has voteRank integer property, and all employees vote on scale of 1-10 and every employee contains list of these votes given by other employees
class Vote {
Integer voteRank
static belongsTo =[employee:Employee]
}
How do I get the avg of all votes given per employee. This can be solved in SQL by using group by clause. But i am looking for grails domain mapping and gorm oriented answer for this problem.