可能重複:
Hibernate HQL: Get count of results without actually returning them如何讓沒有在HQL彙總查詢返回的記錄,而不實際的返回他們
我有一個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
我想得到這個q返回的記錄no uery(沒有實際返回它們)。 Hibenate有沒有辦法做到這一點? thanx提前
thanx Umer,但它告訴使用Criteria API,但我想通過使用HQL – KalpaG 2012-03-13 11:39:52