如何在Hibernate中通过查询编写此组?

时间:2013-04-29 19:35:16

标签: java hibernate

这是sql

的查询
SELECT type ,SUM(amount) FROM CustomerPayment GROUP BY type

我如何在休眠中写这个?

1 个答案:

答案 0 :(得分:2)

在hql中是一样的:

select c.type, sum(c.amount) from CustomerPayment c group by c.type