These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 13 posts ] 
Author Message
 Post subject: createQuery exception???
PostPosted: Wed Dec 27, 2006 2:17 pm 
Newbie

Joined: Wed Oct 04, 2006 2:43 pm
Posts: 16
Location: Lexington, KY
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0

Mapping documents:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
   <class name="com.acs.gs.juror.bo.PoolInfo" table="INFORMIX.POOL">
      <composite-id class="com.acs.gs.juror.bo.PoolInfoKey" mapped="true">
         <key-property name="poolNumber" column="POOL_NO"/>
         <key-property name="sequenceNumber" column="POOL_SEQ"/>
      </composite-id>
      <property name="participantNumber" column="PART_NO"/>
      <property name="poolNumber" column="POOL_NO" insert="false" update="false"/>
      <property name="active" column="IS_ACTIVE"/>
      <property name="firstName" column="fname"/>
      <property name="lastName" column="lname"/>
      <property name="city"/>
      <property name="state"/>
      <property name="zip"/>
      <property name="dateDeferred" type="timestamp" column="DEF_DATE"/>
      <property name="dateDisqualified" type="timestamp" column="DATE_DISQ"/>
      <property name="dateExcused" type="timestamp" column="DATE_EXCUS"/>
      <property name="dateOfBirth" type="timestamp" column="DOB"/>
      <property name="dateNext" type="timestamp" column="NEXT_DATE"/>
      <property name="dateReturn" type="timestamp" column="RET_DATE"/>
      <property name="divisionCode" column="DIVISION_CODE"/>
      <property name="responded"/>
      <property name="homePhone" column="H_PHONE"/>
      <property name="workPhone" column="W_PHONE"/>
      <property name="disqualifiedCode" column="DISQ_CODE"/>
      <property name="excuseCode" column="EXC_CODE"/>
      <property name="courtLocation" column="LOC_CODE"/>
      <property name="notes" column="NOTES"/>
      <property name="numberAwol" column="NO_AWOL"/>
      <property name="numberAttended" column="NO_ATTENDED"/>
      <property name="numberFta" column="NO_FTA"/>
      <property name="numberOfDeferralsPosted" column="NO_DEF_POS"/>
      <property name="onCall" column="ON_CALL"/>
      <property name="sequenceNumber" column="POOL_SEQ" insert="false" update="false"/>
      <many-to-one name="status"
            column="STATUS"
             class="com.acs.gs.juror.bo.PoolStatus"
            fetch="join"
        />
   </class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
using spring
Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Code:
java.lang.NoSuchMethodError: org.hibernate.hql.antlr.HqlBaseParser.recover(Lantlr/RecognitionException;Lantlr/collections/impl/BitSet;)V
   org.hibernate.hql.antlr.HqlBaseParser.concatenation(HqlBaseParser.java:655)
   org.hibernate.hql.antlr.HqlBaseParser.relationalExpression(HqlBaseParser.java:2586)
   org.hibernate.hql.antlr.HqlBaseParser.equalityExpression(HqlBaseParser.java:2542)
   org.hibernate.hql.antlr.HqlBaseParser.negatedExpression(HqlBaseParser.java:2413)
   org.hibernate.hql.antlr.HqlBaseParser.logicalAndExpression(HqlBaseParser.java:2341)
   org.hibernate.hql.antlr.HqlBaseParser.logicalOrExpression(HqlBaseParser.java:2296)
   org.hibernate.hql.antlr.HqlBaseParser.expression(HqlBaseParser.java:2082)
   org.hibernate.hql.antlr.HqlBaseParser.logicalExpression(HqlBaseParser.java:1858)
   org.hibernate.hql.antlr.HqlBaseParser.whereClause(HqlBaseParser.java:454)
   org.hibernate.hql.antlr.HqlBaseParser.queryRule(HqlBaseParser.java:708)
   org.hibernate.hql.antlr.HqlBaseParser.selectStatement(HqlBaseParser.java:296)
   org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:159)
   org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:248)
   org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
   org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
   org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
   org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
   org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
   org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
   org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
   org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
   com.acs.gs.juror.dao.impl.PoolInfoDAOImpl.countByPoolId(PoolInfoDAOImpl.java:39)
   com.acs.gs.ejuror.nvdist.bo.NvDistDeferStrategy.checkLimits(NvDistDeferStrategy.java:92)
   com.acs.gs.ejuror.nvdist.bo.NvDistDeferStrategy.validateDeferral(NvDistDeferStrategy.java:59)
   com.acs.gs.juror.bizstrategy.DeferStrategy.deferParticipant(DeferStrategy.java:127)
   com.acs.gs.eJuror.web.actions.BaselineDeferProcessAction.execute(BaselineDeferProcessAction.java:165)
   org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)
   com.acs.gs.eJuror.web.struts.EJurorRequestProcessor.processActionPerform(EJurorRequestProcessor.java:110)
   org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
   org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
   org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
   org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
   org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
   org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
   org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318)
   org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
   org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
   org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
   com.acs.gs.eJuror.web.servlet.SecurityFilter.doFilter(SecurityFilter.java:85)


I just got this error on the following line of code (using Spring):

Code:
   public int countByPoolId(String poolNo) {
      int result;
      try {
         result = (Integer)getSession().createQuery( //line 39
                     "SELECT count(*) FROM PoolInfo p WHERE p.poolNumber='"+ poolNo
                     + "' AND p.active='Y'"
                     + "' AND p.status.statusCode BETWEEN '1' AND '4'").uniqueResult();
      }
      catch (HibernateException ex) {
         throw convertHibernateAccessException(ex);
      }
      return result;
   }

Anyone have any suggestions?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 27, 2006 2:29 pm 
Senior
Senior

Joined: Sun Jun 04, 2006 1:58 am
Posts: 136
post poolstatus.hbm ... and what is your database ..

try ......

AND p.status.statusCode in ( '1','2','3','4')

_________________
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 27, 2006 2:36 pm 
Newbie

Joined: Wed Oct 04, 2006 2:43 pm
Posts: 16
Location: Lexington, KY
Quote:
post poolstatus.hbm


I did. That's the mapping document...

Quote:
and what is your database ..


Informix 7.34.1 I think.

I tried changing the BETWEEN to IN with no effect.

Thanks for the quick response!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 27, 2006 3:05 pm 
Senior
Senior

Joined: Sun Jun 04, 2006 1:58 am
Posts: 136
thehl wrote:
Quote:
post poolstatus.hbm


I did. That's the mapping document...

Quote:
and what is your database ..


Informix 7.34.1 I think.

I tried changing the BETWEEN to IN with no effect.

Thanks for the quick response!


ummm ... i dont see how you mapped

com.acs.gs.juror.bo.PoolStatus class ... its not up there

_________________
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 27, 2006 3:35 pm 
Newbie

Joined: Wed Oct 04, 2006 2:43 pm
Posts: 16
Location: Lexington, KY
Oh, my apologies for not reading your post more closely.

Anyway, it turns out that the error was simply a parsing error from including two '' after the 'Y'' by accident. This created a mis-matched quotes situation, but should not result in a NoSuchMethodError. I will post this as a defect in hibernate.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 27, 2006 4:40 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
NoSuchMethodError is not a bug in hibernate; it's a "bug" in you using the wrong libraries together.....you probably have something else than the antlr-2.6.x jar distributed with hibernate

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 03, 2007 12:12 am 
Newbie

Joined: Tue Nov 07, 2006 9:32 pm
Posts: 7
Location: NH
I'm also getting this same error and I'm using H3.2 right out of the box. I've scanned my library packages and the only antl library I have is included in the hibernate3.jar file I'm using.

My hql looks like this(formated for readability):
Code:
select meeting.id, meeting.statusCodeEnum, occurrence.statusCodeEnum, meeting.confirmationid, meeting.numParticipants, meeting.meetingtype, occurrence.serviceDefinition.name, meeting.topic, chairperson.personFirstName, chairperson.personLastName, chairperson.VIPLevelDB, meeting.recurrence.id, occurrence.startdate, occurrence.id, occurrence.timezone, postcall.statusDB, preregmeetingkey.otherId, preregreviewerkey.otherId

from
Meeting as meeting,
Occurrence as occurrence,
CossContactHierarchyBase as chairperson,
Namespace as preregmeetingkey,
Namespace as preregreviewerkey,
PostCallWrapUp as postcall

where 
upper(meeting.topic) like ? and
meeting.statusCodeEnum != ? and
meeting.statusCodeEnum != ? and
meeting.statusCodeEnum != ? and
meeting.statusCodeEnum != ? and
meeting.statusCodeEnum != ? and
meeting.id = occurrence.meetingid and
meeting.chairperson.id = chairperson.id and
preregmeetingkey.partyId (+)= meeting.id and
preregmeetingkey.partyTypeEnum (+)= ? and
preregmeetingkey.namespace (+)= ? and
preregreviewerkey.partyId (+)= meeting.id and
preregreviewerkey.partyTypeEnum (+)= ? and
preregreviewerkey.namespace (+)= ? and
postcall.occurrenceId (+)= occurrence.id

order by occurrence.startdate ASC


The query looks fine, no mistakes like the previous poster. This worked in Hibernate 2.1.6. This is one of our JUnit tests.

Ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 03, 2007 1:21 pm 
Newbie

Joined: Tue Nov 07, 2006 9:32 pm
Posts: 7
Location: NH
We've narrowed it down to the (+)= operator. Appearently this was ok in hibernate 2.1.6 but something has changed to make this not ok in 3.2.

I don't have the solution as of yet, so if anyone wants to pipe in, please feel free.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 04, 2007 2:15 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
With respect to the nosuchmethoderror then please report a jira issue that proves it .

with respect to += syntax then that never were valid HQL, but the hibernate 2 parser were "too forgiven" where as Hibernate 3 complains instead of ignoring unknown parts.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 04, 2007 10:29 am 
Newbie

Joined: Tue Nov 07, 2006 9:32 pm
Posts: 7
Location: NH
Yea, left outer joins are so uncommon in the sql world, why was I thinking that HQL would support the common operator for them. How does HQL support left outer joins on query conditions then?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 04, 2007 12:42 pm 
Regular
Regular

Joined: Thu Aug 17, 2006 4:50 am
Posts: 55
Location: Mallorca
Quote:
How does HQL support left outer joins on query conditions then?


with the left fetch join


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 04, 2007 1:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
we use the the ansi standard for them instead of using propritary syntax ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: createQuery exception???
PostPosted: Wed Aug 29, 2012 7:53 am 
Newbie

Joined: Wed Aug 29, 2012 7:50 am
Posts: 1
I solved the problem using createNamedQuery instead of createQuery. As i see, internally the EntityManagerFactory creates a EntityManager-Proxy, that dont has the Method createQuery.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 13 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.