Hibernate auto detection not working
shay1680 Feb 10, 2013 8:48 AMHi,
In a simple test with JPA , hibernate is throwing exceptions due to "Unknown entity" if I rely on auto detection :
<persistence-unit name="EmailTest"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <exclude-unlisted-classes>false</exclude-unlisted-classes> <properties> <!-- Scan for annotated classes and Hibernate mapping XML files --> <property name="hibernate.archive.autodetection" value="class" />
<property name="hibernate.archive.autodetection" value="class" />
But if I set the the enitty class sepcifically in persistence.xml it works :
<persistence-unit name="EmailTest"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>com.project.webea.data.entities.Account</class> <exclude-unlisted-classes>false</exclude-unlisted-classes> <properties> <!-- Scan for annotated classes and Hibernate mapping XML files --> <property name="hibernate.archive.autodetection" value="class" />
Which looks like the hibernate auto detection is not working in the Arquillian archive?
Here is my deployment method:
public static WebArchive makeArchive() { WebArchive archive = ShrinkWrap.create(WebArchive.class, "test.war") .addAsWebInfResource("beans.xml") .addPackage(Account.class.getPackage()) .addAsResource("test-persistence.xml", "META-INF/persistence.xml"); System.out.println(arc.toString(true)); return arc; }
Here is the archive layout:
test.war: /WEB-INF/ /WEB-INF/beans.xml /WEB-INF/classes/ /WEB-INF/classes/com/ /WEB-INF/classes/com/projector/ /WEB-INF/classes/com/projector/webea/ /WEB-INF/classes/com/projector/webea/data/ /WEB-INF/classes/com/projector/webea/data/entities/ /WEB-INF/classes/com/projector/webea/data/entities/Account_.class /WEB-INF/classes/com/projector/webea/data/entities/Account.class /WEB-INF/classes/META-INF/ /WEB-INF/classes/META-INF/persistence.xml
I am using the weld-ee-embedded container
Any suggestions?
Thanks,