views:

2083

answers:

1

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.

+3  A: 

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.

Pascal Thivent
Yes, I'm aware of the plan to include JPA2 in JBoss 5.2 and then the decision to go straight for JBoss 6. I hoped, however, they would at least provide an upgrade path for JBoss 5.1 users since it's unlikely that many of them will adopt 6.x very early. Thanks for the answer.
Bozhidar Batsov
I was actually going through the same exercise and was able to pack all 3.5.x dependent jars to my ear, but there was an error parsing the persistence.xml file. It's unable to override dependencies from the jboss.home/commons/lib folder
Joshua