I am migrating from hibernate 3.0.5 to 3.3.2.GA. I have an HQL Query with a non Default constructor and a join fetch. When i run it with non Default constructor it gives me error
org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list [FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=pr,role=null,tableName=DOCUMENT_PRECEDENCE,tableAlias=precedence1_,origin=DOCUMENT_OUT documentou0_,colums={documentou0_.DOC_PRECEDENCE_ID ,className=Precedence}}] [ select distinct new DocumentOut(doc.id, doc.documentId, pr, doc.subject, doc.dispatchStatus) from DocumentOut doc join fetch doc.precedence pr order by pr.precedenceOrder ] at org.hibernate.hql.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:217) at org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:831) at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:619) at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:672) at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:288) at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:231) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80) at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94) at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156) at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135) at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1651) at Test.createDraftHQLQuery(Test.java:90) at Test.getDraftHQL(Test.java:83) at Test.executeQuery(Test.java:36) at Test.main(Test.java:22)
where as when i comment out the non default constructor it runs fine. This query was working fine in 3.0.5 I need an urgent help as my client is in haste. Kindly help me out with issue, i am stuck up.
|