近日发现HQL中, count()函数要求还比较严格,举例说:
1、count(1)报错
<query name="getRecordCountById"> select count(1) as recordCount from Km c where c.id=:id </query>
2、count(c.*)报错
<query name="getRecordCountById"> select count(c.*) as recordCount from Km c where c.id=:id </query>
3、count(*)正确
<query name="getRecordCountById"> select count(*) as recordCount from Km c where c.id=:id </query>