0

I have been planning on using Hibernate to handle the ORM for an app I will be deploying to an Oracle GlassFish Server (OGS). I'd also like to take advantage of a few features that Bitronix (JTA impl) offers that I really like. Having never worked with OGS before I am concerned that I will not be able to use Hibernate or Bitronix because OGS has (pre-installed) default implementations for JPA and JTA (and others).

Is this true? If I go the OGS route am I stuck with the JPA/JTA implementations that the container comes with? Is this true for all Java EE-compliant containers?

Is there a workaround to this (reconfiguring the classpath, XML/PROPERTIES files, etc.)? Thanks in advance!

IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756

2 Answers2

1

As far as I know most application servers' class-loaders can be configured (for each application deployed on them) to first use application server's libraries (mostly the default behavior) or the application's libraries.

I worked with Weblogic, and in its custom deployment descriptor there is a XML tag to make application's libraries (which are deployed within the WAR file or EAR file) have more priority than application server's libraries.

p.n. It is obvious that you can not config your JTA implementation in GlassFish console.

p.n. Can't you specify JPA provider in your persistence.xml file?

Amir Pashazadeh
  • 7,170
  • 3
  • 39
  • 69
0

This isn't a good idea. Swapping core modules is a risk in general. Most of the core technologies are tightly integrated and can't be switched easily. You are lucky if the desired vendor has support and glue-code for additional providers. In case of OGS you are bound to EclipseLink (JPA RI) or alternatively Hibernate (some update modules including glue-code available). Shipping the stuff with your application could (in the worst case) lead to weird class-loading errors. See my thoughts and a JSF example here: http://blog.eisele.net/2012/07/upgrading-mojarra-in-glassfish.html

Markus Eisele
  • 712
  • 4
  • 9