problème dans l'agregat SUM dans hql
bonjour ;
dans ma requete hql j'ai utilisé dans l'argument du SUM un test le voici :
Code:
1 2
|
select ....,SUM(if(tab.champ1='valeur' ,1,0)) ,.. from tab ..; |
la champs champ1 est du type String ;
a l'execeution une exception se declenche et en voici le code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
xception in thread "main" java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.AggregateNode
+-[AGGREGATE] AggregateNode: 'SUM'
| \-[METHOD_CALL] MethodNode: '('
| +-[METHOD_NAME] IdentNode: 'IF' {originalText=IF}
| \-[EXPR_LIST] SqlNode: 'exprList'
at org.hibernate.hql.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:140)
at org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:702)
at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:531)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:645)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:218)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1583) |
merci pour votre aide