我有这样的HQL count语句
(case app.test when 2 then '' end) as tested
我想引用此文件http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html_single/#queryhql-aggregation
count (case app.test when 2 then 'tested' end) as tested
这个我以后后得到这个app.state所以这样写的计数代码得到错误像
unexpected token: case
任何想法
但是同样的语句工作的MySQL
COUNT(CASE WHEN app.test= 2 THEN "tested" END) 'tested',
的解决方案,我不认为HQL允许ü使用聚合函数的情况下计算..ü可能有使用sql查询。看看[这](http://stackoverflow.com/questions/7068051/case-statement-in-hql-or-criteria?answertab=votes#tab-top) –
没有hql允许聚合函数。我已经使用它们 – Deepak