如果我有三个这样的域类:
class Candidate {
static belongsto=[application:Application]
}
class Vote {
String name;
static belongsto=[application:Application]
}
class Application {
Date datedemand;
Candidate candidates;
Vote votes
static hasMany = [candidates:Candidate,votes:Vote]
}
我想检索按 Vote's Name 分组的所有候选人。
我开始了以下尝试,但我仍然被阻止:
def criteria = Application.createCriteria()
def results = criteria.list {
votes {
}
candidates{
}
}