我有这个查询,其中我使用Group By with ROLLUP,它在MySQL中运行良好。
SELECT r.Region_Name
, ad.District_Name
, COUNT(me.employee_id)
FROM `master_employee` me
INNER JOIN app_district ad
ON me.`district_id` = ad.`DISTRICT_UID`
INNER JOIN region r
ON ad.REGION_UID = r.REGION_UID
GROUP BY ad.REGION_UID, ad.District_Name WITH ROLLUP
HQL
SELECT new com.eld.chart.ChartValues (r.regionName, dm.districtName, STR(COUNT(me.districtModel)))
FROM MasterEmployeeModel me JOIN me.districtModel dm JOIN dm.regionModel r
GROUP BY ROLLUP(me.districtModel, r.regionName)
显示以下异常
17:13:51,311 ERROR [org.hibernate.util.JDBCExceptionReporter] (http-localhost-127.0.0.1-8080-2)
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(masterempl0_.district_id, divisionmo2_.REGION_NAME)' at line 1
对于hibernate,ROLLUP是否有任何有效的替代方法?