Hello,
I am trying to use the latest release of Hibernate EntityManager (3.1beta7) and I have obtained the dependencies stated in the manual, however I am getting an exception. Show below is the sample code and the exception.
Code:
public void test_bootstrap() {
// Use persistence.xml configuration
EntityManagerFactory emf = Persistence.createEntityManagerFactory("appssoEtyMgr");
EntityManager em = emf.createEntityManager(); // Retrieve an application managed entity manager
assertNotNull(em);
...
}
I get the following exception:
Quote:
java.lang.NoClassDefFoundError: org/jboss/util/file/ArchiveBrowser$Filter
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:109)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27)
at com.evergreen.userlinks.biz.EntityManagerConfigTest.test_bootstrap(EntityManagerConfigTest.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
I am a little surprised by the JBoss-dependency in the exception; I thought Hibernate EntityManager is supposed to act as an EJB3-style facade to Hibernate SessionFactory. Must I use the JBoss AS or microcontainer to use Hibernate EntityManager? The documentation below doesn't say anything about requiring JBoss.
Quote:
2.1. Setup
The EJB3 compatible Hibernate EntityManager is built on top of Hibernate core and Hibernate Annotations. You have to use compatible versions of each module. This version is known to work on Hibernate 3.2.0.CR2 and Hibernate Annotations 3.1beta9. The following libraries have to be in your classpath: hibernate3.jar, hibernate-annotations.jar, hibernate-entity-manager.jar and all needed third party libraries for each package.(incl. ejb-persistence.jar).
Any help appreciated.
Thanks.
PS - I can't find Hibernate 3.2.0CR2 anywhere on the Hibernate web site (only CR1).