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:
|