67,513
社区成员
发帖
与我相关
我的任务
分享
String sql = "select new edu.nju.healthclub.model.FieldUsage(nnd,count(*))from"
+ "(select case"
+ " when age>=0 and age<=10 then '1-10' "
+ " when age>=11 and age<=20 then '11-20' "
+ " when age>=21 and age<=30 then '21-30' "
+ " when age>=31 and age<=40 then '31-40' "
+ " when age>=41 and age<=50 then '41-50' "
+ " when age>=51 and age<=60 then '51-60' "
+ " when age>=61 then '>60' "
+ " end as nnd from edu.nju.healthclub.model.Member) group by nnd";
org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: ( near line 1, column 65 [select new edu.nju.healthclub.model.FieldUsage(nnd,count(*))from(select case when age>=0 and age<=10 then '1-10' when age>=11 and age<=20 then '11-20' when age>=21 and age<=30 then '21-30' when age>=31 and age<=40 then '31-40' when age>=41 and age<=50 then '41-50' when age>=51 and age<=60 then '51-60' when age>=61 then '>60' end as nnd from edu.nju.healthclub.model.Member) group by nnd]
at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)
at org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:79)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:276)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:180)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:105)
at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168)