[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2327?page=all ]
Max Rydahl Andersen closed HHH-2327:
------------------------------------
Resolution: Rejected
use the antlr.jar that is distributed with hibernate.
Syntax error generates NoSuchMethodException
--------------------------------------------
Key: HHH-2327
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2327
Project: Hibernate3
Type: Bug
Components: core
Environment: Whatever version ships with Spring 2.0.
Informix 7.34.1
Reporter: Thom Hehl
Original Estimate: 1 day
Remaining: 1 day
This source 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;
}
Generates this error:
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)
It turns out the error was caused by the fact that at the beginning of the third line of
the query I accidentally added a second '' after the Y at the end of the second
line. This should generate some kind of syntax exception instead of this messy
NoSuchMethodException.
The mapping file looks like:
<?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>
Thanks.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira