我认为第15.6节。select子句涵盖您要实现的目标:
15.6。选择子句
…
查询可以将多个对象和/或属性作为类型数组返回
Object[]:select mother, offspr, mate.namefrom DomesticCat as mother inner join mother.mate as mate left outer join mother.kittens as offspr或作为
List:select new list(mother, offspr, mate.name)from DomesticCat as mother inner join mother.mate as mate left outer join mother.kittens as offspr或者-假设该类
Family具有适当的构造函数-作为实际的类型安全的Java对象:select new Family(mother, mate, offspr)from DomesticCat as mother join mother.mate as mate left join mother.kittens as offspr
就您而言,您可能想要:
SELECt new MyCustomList(product.pre, SUM(product.price), COUNT(product.pre))from Product AS productGROUP BY product.pre
在哪里
MyCustomList不一定是映射实体。



