Upgrading GlassFish 3.1.2.2 to use JPA 2.1

老子叫甜甜 提交于 2019-11-26 22:02:33

问题


I am working with GlassFish 3.1.2.2 (I can not upgrade to 4 due to OS restrictions).

I'm interested in upgrading JPA 2.0 to JPA 2.1 GlassFish 3.1.2.2. How can I achieve this?


回答1:


This is most likely not possible at all. JPA 2.1 is part of EE 7 and therefore not fully integrated with EE 6 GF 3.1.2.2.




回答2:


Did you try just replacing the EclipseLink and JPA jar files in Glassfish?

It will probably work, but if you use managed persistence units they will not expose any JPA 2.1 API, you would need to unwrap the EntiyManager to access these.




回答3:


I'm using Hibernate 4.3.8 (requires JPA 2.1) with Glassfish 3.1.2.2.

Note: I'm not using any services provided by glassfish. All the libraries I use are in the WEB-INF/lib.

1 - Override all JPA classes (package javax.persistence) in glassfish/modules/javax.persistence.jar with JPA 2.1 version. You should not replace the entire JAR, only override the classes. This JAR has an OSGI manifest and other classes that must remain there.

2 - Remove all javassist classes (package javasssist) from glassfish/modules/weld-osgi-bundle.jar. This solves a possible incompatibility if you are using Hibernate.



来源:https://stackoverflow.com/questions/18447541/upgrading-glassfish-3-1-2-2-to-use-jpa-2-1

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