Hibernate version:3.0.5
Hi im migrating from hibernate 2 to hibernate 3 and several of the hql that where working are not working any more
for example the execute of this query:
select opp from org.volsystems.db.Opportunity as opp
inner join fetch opp.organization
, opp.volunteerCenter as vc
where opp.statusOpportunity.id = org.volsystems.db.StatusOpportunity.ACTIVE and vc.id = :vcId and ( ( opp.onGoing = true and vc.enableNewestLongTermOpportunity = true ) or ( opp.onGoing = false and vc.enableNewestOneTimeOpportunity = true ) ) and opp.endDate >= :dateParam and opp.activity = :isActivity order by opp.createdDate desc, opp.startDate asc
throws the exception
2005-09-09 01:14:14,875 ERROR org.hibernate.hql.PARSER - *** ERROR: opp.volunteerCenter is not mapped.
2005-09-09 01:14:15,015 ERROR org.hibernate.hql.PARSER - *** ERROR: Invalid path: 'vc.id'
2005-09-09 01:14:15,015 ERROR org.hibernate.hql.PARSER - *** ERROR: <AST>:0:0: unexpected end of subtree
2005-09-09 01:14:15,078 ERROR org.hibernate.hql.PARSER - *** ERROR: Invalid path: 'vc.enableNewestLongTermOpportunity'
2005-09-09 01:14:15,078 ERROR org.hibernate.hql.PARSER - *** ERROR: <AST>:0:0: unexpected end of subtree
2005-09-09 01:14:15,140 ERROR org.hibernate.hql.PARSER - *** ERROR: Invalid path: 'vc.enableNewestOneTimeOpportunity'
2005-09-09 01:14:15,140 ERROR org.hibernate.hql.PARSER - *** ERROR: <AST>:0:0: unexpected end of subtree
org.hibernate.hql.ast.QuerySyntaxError: opp.volunteerCenter is not mapped. [select opp from org.volsystems.db.Opportunity as opp inner join fetch opp.organization , opp.volunteerCenter as vc where opp.statusOpportunity.id = org.volsystems.db.StatusOpportunity.ACTIVE and vc.id = :vcId and ( ( opp.onGoing = true and vc.enableNewestLongTermOpportunity = true ) or ( opp.onGoing = false and vc.enableNewestOneTimeOpportunity = true ) ) and opp.endDate >= :dateParam and opp.activity = :isActivity order by opp.createdDate desc, opp.startDate asc]
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:196)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:834)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at org.volsystems.db.VolunteerCenter.getNewestOpportunities(VolunteerCenter.java:986)
at org.volsystems.controller.action.VcindexAction.execute(VcindexAction.java:154)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.volsystems.util.RequestProcessor.processActionPerform(RequestProcessor.java:285)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at com.admanagement.admin.AdActionServlet.process(AdActionServlet.java:208)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20)
at org.volsystems.util.OneSessionPerRequestFilter.doFilter(OneSessionPerRequestFilter.java:114)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:600)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Thread.java:534)
Caused by: opp.volunteerCenter is not mapped.
at org.hibernate.hql.ast.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:85)
at org.hibernate.hql.ast.FromElementFactory.addFromElement(FromElementFactory.java:77)
at org.hibernate.hql.ast.FromClause.addFromElement(FromClause.java:67)
at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:217)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:2830)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2719)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:513)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:371)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:201)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:151)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
... 29 more
The exception says that opp.volunteerCenter is not mapped but i check and is maped , and is an very old query that worked fine with hiber 2
i set this
<property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
to the hibernate.cfg.xml
to remove the ast and use the old parser and all the querys seem to work fine again, but i removed to try to find the error, and the only way i could make the query run with the ast hql parser was
changing this
select opp from org.volsystems.db.Opportunity as opp
inner join fetch opp.organization
, opp.volunteerCenter as vc ...
for this
select opp from org.volsystems.db.Opportunity as opp
inner join fetch opp.organization
inner join opp.volunteerCenter as vc ...
as you can see i remove the implicit join and it work , to confirm i changed that to others querys and it worked too, the problem is that im migrating a large application and ill have to change all the hql that use implicit joins with will be a lot of work, i supose i will have to use the old hql parser, but i wanted to use all the new cool features of the ast hql parser. So it is a bug? if it is do you have a fix in the cvs or something, or maybe you deprecate implicit joins of the ast parser.
Please help me.
|