Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
I have just upgraded to Hibernate 3.0 (my project is in initial stages). However, the HQL queries that were running using 2.1.8 are now failing.
My query is very simple:
<query name='searchRelease'> <![CDATA[from Release as rel where rel.platformId = :platformId and rel.productId = :productId ]]></query>
I have read the documentation but still I do not know why it fails, can anyone be kind enough to give me a hint what is wrong?
Below are the stack trace and more information.
Hibernate version: 3.0
Mapping documents:
<?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 package="iadm.readme.model">
<class name="iadm.readme.model.Release" table="README.RELEASE" >
<id name="id" column="RELEASE_ID" type="long" >
<generator class="native"/>
</id>
<property name="platformId" type="long" column="PLATFORM_ID" not-null="true"/>
<property name="productId" type="long" column="PRODUCT_ID" not-null="true"/>
</class>
<query name='searchRelease'> <![CDATA[from Release as rel where rel.platformId = :platformId and rel.productId = :productId ]]></query>
</hibernate-mapping>
My function:
public Collection searchRelease(long platformId,
long productId, Session session) {
Collection release = null;
try {
release = (Collection) session.getNamedQuery("searchRelease").setLong("platformId", platformId)
.setLong("productId", productId).list();
} catch (HibernateException ex) {
throw new InfrastructureException(ex);
}
return release;
}
Full stack trace of any exception that occurs:
3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O java.lang.NoClassDefFoundError: antlr/RecognitionException
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at org.hibernate.hql.ast.ASTQueryTranslatorFactory.createQueryTranslator(ASTQueryTranslatorFactory.java:27)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at org.hibernate.impl.SessionFactoryImpl.createQueryTranslators(SessionFactoryImpl.java:344)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:410)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:375)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:278)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1043)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at iadm.readme.utils.HibernateUtil.<init>(HibernateUtil.java:24)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at iadm.readme.utils.HibernateUtil.<clinit>(HibernateUtil.java:19)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at iadm.readme.tests.ReleaseDAOTest.testSearchRelease(ReleaseDAOTest.java:58)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at junit.framework.TestCase.runTest(TestCase.java:154)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at junit.framework.TestCase.runBare(TestCase.java:127)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at junit.framework.TestResult$1.protect(TestResult.java:106)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at junit.framework.TestResult.runProtected(TestResult.java:124)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at junit.framework.TestResult.run(TestResult.java:109)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at junit.framework.TestCase.run(TestCase.java:118)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at junit.framework.TestSuite.runTest(TestSuite.java:208)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at junit.framework.TestSuite.run(TestSuite.java:203)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at org.junitee.runner.TestRunner$1.run(TestRunner.java:72)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at org.junitee.runner.TestRunner.run(TestRunner.java:95)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at org.junitee.servlet.JUnitEEServlet.runTests(JUnitEEServlet.java:232)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at org.junitee.servlet.JUnitEEServlet.doGet(JUnitEEServlet.java:203)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1019)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:592)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:204)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:286)
[3/1/05 20:16:48:175 EST] 6b0ac549 SystemOut O at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
[3/1/05 20:16:48:185 EST] 6b0ac549 SystemOut O at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
[3/1/05 20:16:48:185 EST] 6b0ac549 SystemOut O at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
[3/1/05 20:16:48:185 EST] 6b0ac549 SystemOut O at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
[3/1/05 20:16:48:185 EST] 6b0ac549 SystemOut O at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:615)
[3/1/05 20:16:48:185 EST] 6b0ac549 SystemOut O at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
[3/1/05 20:16:48:185 EST] 6b0ac549 SystemOut O at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:912)
Name and version of the database you are using: DB2 8.2