I have a strange situation where I have a simple HQL query which is failing.
I am unable to find the whats the issue with the code, below is the error followed by the code:
Code:
java.lang.ArrayIndexOutOfBoundsException: 143
at antlr.BaseAST.toString(BaseAST.java:322)
at antlr.BaseAST.toStringList(BaseAST.java:341)
at antlr.BaseAST.toStringList(BaseAST.java:343)
at antlr.BaseAST.toStringList(BaseAST.java:343)
at antlr.BaseAST.toStringTree(BaseAST.java:358)
at org.hibernate.hql.internal.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:629)
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:663)
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:299)
at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:247)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:249)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:184)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:137)
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)
at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:221)
at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:199)
at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1778)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:291)
at sun.reflect.GeneratedMethodAccessor1360.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:294)
at com.sun.proxy.$Proxy145.createQuery(Unknown Source)
Below is the code:
Code:
List<Object[]> mmReports = this.entityManager.createQuery(
"SELECT dmr.bankCardNumber, dmr.accountNumber, dmr.transactionType, "
+ "sum(dmr.dayCount) from "
+ DMR.class.getName() + " dmr WHERE dmr.month =:month AND dmr.transactionType=:txnType "
+ "GROUP BY dmr.bankCardNumber, dmr.accountNumber, dmr.transactionType")
.setParameter("month", month)
.setParameter("txnType", txnType)
.getResultList()