I'm fairly new to Hibernate and I'm trying to set up ant (1.7.1) to run my junit4 tests etc. However, it seems I keep running into this one exception (as seen below) from my junit reports. I'm not quite sure what's going on. My only guess is that ant isn't running in a jboss container and is therefore not excuting something that the container would. As a result, the annotations on the com.xxxx.pcm.spi.builder.xmlbuilders.ItemOwnerXmlBuilderRecord class are not getting read and therefore the mapping from the mapping file isn't working. Hence the reason why I am getting the "Errors in named queries: importer:itemOwnerSelect"
Any thoughts on what I could be doing wrong? Thanks for any help!
Hibernate version:
3.2
Mapping documents:
<?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[
<query here - trying to save space, yes it works when run with sqldeveloper or sqlplus or in eclipse>
]]>
</query>
</named-native-query>
<sql-result-set-mapping name="mapping:itemOwnerSelect">
<entity-result entity-class="com.xxxx.pcm.spi.builder.xmlbuilders.ItemOwnerXmlBuilderRecord"/>
</sql-result-set-mapping>
Full stack trace of any exception that occurs:
java.lang.ExceptionInInitializerError at com.xxx.common.util.persistence.HibernateUtil.init(HibernateUtil.java:69) at com.xxx.pcm.spi.builder.JunitSetup.setup(Unknown Source) at com.xxx.pcm.spi.builder.xmlbuilders.ItemOwnerXmlBuilderTest.setup(Unknown Source)Caused by: 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:83) at com.xxx.common.util.persistence.HibernateUtil.init(HibernateUtil.java:61)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)N/A
java.lang.NullPointerException at com.xxx.pcm.spi.builder.xmlbuilders.ItemOwnerXmlBuilderTest.tearDown(Unknown Source)
Name and version of the database you are using:
Oracle 10.2
The generated SQL (show_sql=true):