Hibernate version:
hibernate-Using 3.0.3, the problem also occurs with 3.1 rc3
Name and version of the database you are using:
Oracle 9i
The generated HQL:
SELECT dto FROM gov.va.med.domain.model.Cytology dto LEFT JOIN FETCH dto.institution LEFT JOIN FETCH dto.institution.state LEFT join fetch dto.cytologySpecimens WHERE dto.patient.id = :userId AND dto.finalizationDate <= sysdate - 7
The above hql results in the following error: Error> <org.hibernate.hql.PARSER> <000000> <<AST>: unexpected end of subtree>
Stack trace:
org.hibernate.hql.ast.QuerySyntaxException: unexpected end of subtree [SELECT dto FROM gov.va.med.domain.model.Cytology dto LEFT JOIN FETCH dto.institution LEFT JOIN FETCH dto.institution.state LEFT join fetch dto.cytologySpecimens WHERE dto.patient.id = :userId AND dto.finalizationDate <= sysdate - 7 AND dto.id IN ()]
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:223)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:156)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:103)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:72)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:52)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:108)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1007)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at gov.va.med.domain.persistence.util.HibernateTableLoader.getRows(HibernateTableLoader.java:119)
at gov.va.med.domain.persistence.orm.dao.CytologiesDAOTest.testCytologyHoldForReview(CytologiesDAOTest.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: <AST>: unexpected end of subtree
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2933)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:686)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:542)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.collectionFunctionOrSubselect(HqlSqlBaseWalker.java:4233)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.inRhs(HqlSqlBaseWalker.java:4142)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3825)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1756)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1684)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:774)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:575)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:279)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:227)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:216)
... 23 more
If I change the < to a >, or change the minus to a plus, then it works.
I also get the same error if I try:
AND NOT dto.finalizationDate <= sysdate - 7
Parenthesis don't make a difference.
If anyone can provide a workaround to this problem I'd appreciate it.
Thanks.
|