Hibernate 3.5-Final in JBoss 5.1.0.GA

♀尐吖头ヾ 提交于 2019-12-19 16:48:37

问题


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.


回答1:


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.




回答2:


I have build a workaround for this specific issue. Instead of re-explaining it here, I prefer send you directly the link to the post with all details.

You can find here : How to use JPA2 on JBoss 5.x ? (or How to eliminate class loading isolation issue?)




回答3:


I also added some instructions to the above link that worked for me.



来源:https://stackoverflow.com/questions/2588108/hibernate-3-5-final-in-jboss-5-1-0-ga

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!