So I have reduced my external query mapping to only one query and hibernate gives me the following error. My mapping xml file is below and I really can't see any errors in it that would cause this error. I'm thinking that a second pair of eyes will help?
2009-Feb-10 13:54:54:841 util.persistence.HibernateUtil ERROR Initial SessionFactory creation failed.
javax.persistence.PersistenceException: org.hibernate.HibernateException: Errors in named queries: importer:itemOwnerSelect
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:720)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
at com.xxx.common.util.persistence.HibernateUtil.init(HibernateUtil.java:64)
at com.xxx.pcm.spi.builder.JunitSetup.setup(Unknown Source)
at com.xxx.pcm.spi.builder.xmlbuilders.ItemOwnerXmlBuilderTest.setUp(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:420)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:911)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:768)
Caused by: org.hibernate.HibernateException: Errors in named queries: importer:itemOwnerSelect
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:365)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)
... 26 more
Code:
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
version="1.0">
<named-native-query name="importer:itemOwnerSelect" result-set-mapping="mapping:itemOwnerSelect">
<query>
<![CDATA[
SELECT
DISTINCT ASSIGNMENT_KEY,
ITEM_IDENTIFIER,
OWNER_NAME,
BUSINESS_ENTITY_IDENTIFIER,
BUSINESS_ENTITY_TYPE_KEY,
DATA_SOURCE,
LAST_REV_CHANGE_DATE
FROM IV_ITEM_OWNER
WHERE ((LAST_REV_CHANGE_DATE <= :update_date)
OR
(LAST_REV_CHANGE_DATE IS NULL))
ORDER BY ASSIGNMENT_KEY ASC
]]>
</query>
</named-native-query>
<sql-result-set-mapping name="mapping:itemOwnerSelect">
<entity-result entity-class="com.xxx.xxx.xxx.xxxx.xxxxx.ItemOwnerXmlBuilderRecord"/>
</sql-result-set-mapping>
</entity-mappings>