投影被用于定制查询结果. 要使用投影你需要在criteria builder树里定义一个"projections"节点.
projections节点内可用的方法等同于 Hibernate 的 Projections 类中的方法:def c = Account.createCriteria()
def numberOfBranches = c.get {
projections {
countDistinct('branch')
}
}
投影被用于定制查询结果. 要使用投影你需要在criteria builder树里定义一个"projections"节点.
projections节点内可用的方法等同于 Hibernate 的 Projections 类中的方法:def c = Account.createCriteria()
def numberOfBranches = c.get {
projections {
countDistinct('branch')
}
}