参见Hibernate文档-15.6。select子句:
您可以使用以下方式为选定的表达式分配别名:
select max(bodyWeight) as max, min(bodyWeight) as min, count(*) as nfrom Cat cat
与选择新地图一起使用时,这非常有用:
select new map( max(bodyWeight) as max, min(bodyWeight) as min, count(*) as n )from Cat cat
该查询返回一个从别名到所选值的映射。



