Version of Hibernate : 3.2.3
Full stack trace of any exception that occurs:
Code:
org.hibernate.hql.ast.QuerySyntaxException: unexpected end of subtree [select new Destination(:op,o) from MMSOperator o where
o in (select d.requested from Destination d where d.source = :op and (d.status.key = :rejected or d.status.key = :failed)) or o in (select d.source from Destination d where d.requested = :op and (d.status.key = :rejected or d.status.key = :failed)) or ( o not in (select d.source from Destination d where d.requested = :op ) and o not in (select d.requested from Destination d where d.source = :op )) and o!= :op]
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31)
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24)
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
at org.hibernate.hql.ast.QueryTranslatorImpl.generate(QueryTranslatorImpl.java:219)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:180)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
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:1623)
at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:863)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedParam(HibernateTemplate.java:861)
at com.bics.mms.electiontool.dao.spring.hibernate.DestinationDaoImpl.findAllPossibleDestinations(DestinationDaoImpl.java:79)
at com.bics.mms.electiontool.services.DestinationServiceImpl.getAllPossibleDestinations(DestinationServiceImpl.java:38)
at com.bics.mms.electiontool.bo.DestinationTest.testAllPossibleDestinations(DestinationTest.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Name and version of the database you are using : Oracle 10gThis problem arise with this query :
Code:
"select new Destination(:op,o) " +
"from MMSOperator o " +
"where o in (select d.requested from Destination d " +
" where d.source = :op" +
" and (d.status.key = :rejected or d.status.key = :failed)) " +
" or o in (select d.source from Destination d " +
" where d.requested = :op" +
" and (d.status.key = :rejected or d.status.key = :failed)) " +
" or ( o not in (select d.source from Destination d where d.requested = :op ) " +
" and o not in (select d.requested from Destination d where d.source = :op )) " +
" and o!= :op";
I can assure you that the variables are well bounded (:op, :rejected and :failed) to the query because when you delete the creation of Destination, that is when you remove "new Destination(:op,o)", it works well !
Am I doing the creation of the Destination object the wrong way ?