Samy Omar
Samy Omar

Reputation: 810

Upgrading GlassFish 3.1.2.2 to use JPA 2.1

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?

Upvotes: 1

Views: 3456

Answers (3)

Rogel Garcia
Rogel Garcia

Reputation: 1915

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.

Upvotes: 1

James
James

Reputation: 18379

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.

Upvotes: 1

Markus Eisele
Markus Eisele

Reputation: 722

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.

Upvotes: 5

Related Questions