-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate Exception: Error in named queries:
PostPosted: Tue Jan 24, 2006 2:14 pm 
I'm travel trouble during the initialization of my mapping files. The problem is wit the queries because when I comment them out they work. I have referenced several books including "Pro Hibernate 3" page 156. Can't seem to get past this despite 2 days of searching and referencing several books out there. It appears that there might be some changes in mapping files between Hib 2 and Hib 3. So the latest attempt was taken with a book dedicated to version 3.



Hibernate version: 3.11

Mapping documents:


"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.everware.component.unittest.person">
<class name="StatusReference" table="StatusReference">
<composite-id>
<key-property column="STATUS_CODE" name="statusCode" type="string" />
<key-property column="STATUS_EFFECTIVE_DT" name="statusEffectiveDate" type="date" />
</composite-id>
<property column="STATUS_DESCRIPTION" insert="true" name="statusDescription" not-null="true" type="string" unique="false" update="true" />
<property column="CREATED_TS" insert="true" name="createdTimestamp" not-null="true" type="date" unique="false" update="true" />
<property column="CREATED_USERID" insert="true" name="createdUserID" not-null="true" type="string" unique="false" update="true" />
<property column="LAST_UPDATED_USERID" insert="true" name="lastUpdatedUserID" not-null="true" type="string" unique="false" update="true" />
<property column="STATUS_END_DATE" insert="true" name="statusEndDate" not-null="true" type="date" unique="false" update="true" />
<property column="LAST_UPDATED_TS" insert="true" name="lastUpdatedTimestamp" not-null="true" type="date" unique="false" update="true" />
<set cascade="none" inverse="true" name="PersonStatuss">
<key>
<column name="STATUS_CODE" />
<column name="STATUS_EFFECTIVE_DT" />
</key>
<one-to-many class="com.everware.component.unittest.person.PersonStatus" />
</set>
</class>
<query name="findAll"><![CDATA[from StatusReference statusreference]]></query>
</hibernate-mapping>





Code between sessionFactory.openSession() and session.close():

public static void initialize (String configFileName) throws HibernateException {
if (null == configFileName && sessionFactoryMap.size() > 0) return;
else if (null != sessionFactoryMap.get(configFileName)) return;
else {
Configuration cfg = new Configuration();
if (null == configFileName)
cfg.configure();
else
cfg.configure(configFileName);
setSessionFactory(configFileName, cfg.buildSessionFactory());
}
}




Full stack trace of any exception that occurs:

org.hibernate.HibernateException: Errors in named queries: com.everware.componen
t.unittest.person.StatusReference.com.everware.component.unittest.person.PersonS
atus.findAll
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
338)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1164)
at com.everware.component.unittest.person.BaseRootDao.initialize(Unknown
Source)
at com.everware.component.unittest.person.BaseRootDao.initialize(Unknown
Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.setUp(Un
known Source)
at junit.framework.TestCase.runBare(TestCase.java:125)
at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(Abstr
actCactusTestCase.java:149)
at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(Abstra
ctWebTestCaller.java:119)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest_aroundBody0(AbstractWebTestController.java:93)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest_aroundBody1$advice(AbstractWebTestController.java:217)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest(AbstractWebTestController.java)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(Ser
vletTestRedirector.java:101)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$adv
ice(ServletTestRedirector.java:217)
at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedi
rector.java)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(Serv
letTestRedirector.java:72)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advi
ce(ServletTestRedirector.java:217)
at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedir
ector.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)




Name and version of the database you are using:

Oracle Version 9.01



The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
  
 
 Post subject:
PostPosted: Tue Jan 24, 2006 3:05 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
enable error logging for org.hibernate.impl.SessionFactoryImpl, it'll tell you exactly what the errors were with each of the named queries that failed.


Top
 Profile  
 
 Post subject: Is this as simple as its sounds ?
PostPosted: Tue Jan 24, 2006 6:04 pm 
Put the log4j.properties into the classpath. I start weblogic server and I can see that its there. But when I run the cactus unit tests that test my hibernate code I see no additional debug information to assist with my original issue. I did go through that properties file and change the settings. But I see no evidence that its even been found by Hibernate. There is no evidence from the console that indicates its doing any logging for Hibernate.


This is my classpath below as it exists in the console during server startup of weblogic.

CLASSPATH=C:\J2SDK1~1\J2SDK1~1.2\lib\tools.jar;C:\bea813\WEBLOG~1\server\lib\weblogic_sp.jar;C:\bea813\WEBLOG~1\server\lib\weblogic.jar;C:\bea813\WEBLOG~1\common\eval\pointbase\lib\pbserver44.jar;C:\bea813\WEBLOG~1\common\eval\pointbase\lib
\pbclient44.jar;C:\J2SDK1~1\J2SDK1~1.2\jre\lib\rt.jar;C:\bea813\WEBLOG~1\server\ lib\webservices.jar;
C:\allison\personMgrNew\log4j.properties


Top
  
 
 Post subject: log4j dump
PostPosted: Tue Jan 24, 2006 7:02 pm 
Im going to verify but I believe those jars are there.


org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlT
oken [from com.everware.component.unittest.person.Person person]
at org.hibernate.hql.ast.HqlLexer.panic(HqlLexer.java:57)
at antlr.CharScanner.setTokenObjectClass(CharScanner.java:340)
at org.hibernate.hql.ast.HqlLexer.setTokenObjectClass(HqlLexer.java:31)
at antlr.CharScanner.<init>(CharScanner.java:51)
at antlr.CharScanner.<init>(CharScanner.java:60)
at org.hibernate.hql.antlr.HqlBaseLexer.<init>(HqlBaseLexer.java:56)
at org.hibernate.hql.antlr.HqlBaseLexer.<init>(HqlBaseLexer.java:53)
at org.hibernate.hql.antlr.HqlBaseLexer.<init>(HqlBaseLexer.java:50)
at org.hibernate.hql.ast.HqlLexer.<init>(HqlLexer.java:26)
at org.hibernate.hql.ast.HqlParser.getInstance(HqlParser.java:44)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.j
ava:232)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorIm
pl.java:155)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl
.java:105)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCa
che.java:71)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactor
yImpl.java:363)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
327)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1164)
at com.everware.component.unittest.person.BaseRootDao.initialize(Unknown
Source)
at com.everware.component.unittest.person.BaseRootDao.initialize(Unknown
Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.setUp(Un
known Source)
at junit.framework.TestCase.runBare(TestCase.java:125)
at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(Abstr
actCactusTestCase.java:149)
at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(Abstra
ctWebTestCaller.java:119)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest_aroundBody0(AbstractWebTestController.java:93)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest_aroundBody1$advice(AbstractWebTestController.java:224)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest(AbstractWebTestController.java)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(Ser
vletTestRedirector.java:101)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$adv
ice(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedi
rector.java)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(Serv
letTestRedirector.java:72)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advi
ce(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedir
ector.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
org.hibernate.HibernateException: Errors in named queries: findAllPersons
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
338)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1164)
at com.everware.component.unittest.person.BaseRootDao.initialize(Unknown
Source)
at com.everware.component.unittest.person.BaseRootDao.initialize(Unknown
Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.setUp(Un
known Source)
at junit.framework.TestCase.runBare(TestCase.java:125)
at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(Abstr
actCactusTestCase.java:149)
at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(Abstra
ctWebTestCaller.java:119)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest_aroundBody0(AbstractWebTestController.java:93)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest_aroundBody1$advice(AbstractWebTestController.java:224)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest(AbstractWebTestController.java)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(Ser
vletTestRedirector.java:101)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$adv
ice(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedi
rector.java)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(Serv
letTestRedirector.java:72)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advi
ce(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedir
ector.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
I


Top
  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.