【发布时间】:2012-03-13 11:33:07
【问题描述】:
可能重复:
Hibernate HQL: Get count of results without actually returning them
我有一个这样的 hql 查询
select new map(t.divisionId as divisionId,t.projectId as projectId,t.roleId as roleId,t.userId as userId, t.reference as reference,t.note as note,sum(t.hoursPlanned) as hoursPlanned,sum(t.hoursUnplanned) as hoursUnplanned,sum(t.hoursPlanned) + sum(t.hoursUnplanned) as total) from TimeSheetsWork t where t.divisionId in :_divisions group by t.divisionId,t.userId,t.projectId,t.roleId
我想获取从此查询返回的记录数(实际上不返回它们)。 Hibenate有没有办法做到这一点?提前致谢
【问题讨论】:
-
thanx Umer,但它告诉使用 Criteria API 但我想通过使用 HQL 来完成它