Hibernate 3.5-Final is finally here and it offers the much anticipated JPA2 support, amongst other features. I am working on a project(EJB3 based) using JBoss 5.1.0.GA and Hibernate 3.3, but I wanted to take advantage of the JPA2 and tried to upgrade to Hibernate 3.5.
What I did was fairly simple and standard - I just put all the hibernate 3.5 jars in the server/configuration(default,all,etc)/lib folder - that way they take precedence over the hibernate artifacts shipped with JBoss. It seems though that JBoss ships with libraries that are dependent on the JPA1 implementation part of the hibernate 3.3, because I started getting some errors about unimplemented abstract methods and stuff like that on deploy:
23:21:26,792 WARN [Ejb3Configuration] Persistence provider caller does not implement the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is null.
23:21:26,792 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=kernel-ear-3.3.0-SNAPSHOT.ear/config-persistence.jar#ConfigurationPersistenceUnit state=Create
java.lang.AbstractMethodError: org.jboss.jpa.deployment.PersistenceUnitInfoImpl.getValidationMode()Ljavax/persistence/ValidationMode;
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:613)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:72)
at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:301)
at sun.reflect.GeneratedMethodAccessor308.invoke(Unknown Source)
Maybe I should use a different persistence provided? Currently it's:
org.hibernate.ejb.HibernatePersistence
I looked around the net and didn't find any documented upgrade paths. There was even an unanswered question here in stack overflow on the topic.
Any ideas, suggestions? Thanks in advance for your help.
It seems though that JBoss ships with libraries that are dependent on the JPA1 implementation part of the hibernate 3.3
Yes, it does (see this old mail to get an idea) and I don't think that your current approach is possible. My understanding is that JPA 2 integration was planned for JBoss 5.2 but it seems that they decided to skip this branch to go directly to JBoss 6.x.