As you must be aware, Glassfish currently has Toplink Essentials as the default persistence provider. The question that frequently gets asked is: How hard it is to to use hibernate as the persistence provider with Glassfish?
The answer is: Not at all
. Just drop couple of jars reqired by hibernate in the lib directory of Glassfish and modify your persistence.xml to use hibernate as the provider and you are ready to go. Lets walk through the steps:
1. Download and install glassfish milestone 6 build or later.
2. Download and install Hibernate3 3.2cr1 or later.
3. Download and install Hibernate EntityManager 3.1 beta7 or later.
4. Copy the required hibernate jars into Glassfish lib dir. The script here contains the list of jars.
5. Update your persistence.xml to use hibernate as the persistence provider. Here is a sample persistence.xml
6. Deploy and run your application.
Posted by Gene De Lisa on June 02, 2006 at 01:44 PM PDT #
Posted by Mitesh on June 28, 2006 at 11:23 PM PDT #
Posted by Sahoo on July 17, 2006 at 10:21 AM PDT #
Posted by Joe on August 27, 2006 at 10:37 AM PDT #
Posted by Mr.K on December 09, 2006 at 12:31 PM PST #
com.sun.enterprise.deployment.backend.IASDeploymentException: Could not resolve a persistence unit corresponding to the persistence-context-ref-name [mypackage.MyClass/myPU] in the scope of the module called [].
To this day I haven't been successful getting any persistence framework to run with Glassfish with the exception of the provided Toplink, which is extremely slow.Posted by Ulrich Mayring on June 14, 2007 at 02:12 AM PDT #
java.lang.NoClassDefFoundError: javax/transaction/SystemException
UlrichPosted by 81.91.160.27 on June 14, 2007 at 02:50 AM PDT #
Hi all,
Thanks a lot, your description helped me a lot. I just did it. It took me something like 30 minutes (something that can help is watching out the compat' matrix to put compatible HEM, H3 and HA jars together: http://www.hibernate.org/6.html#A3)
Is there a way to change the default provider?
I mean: be able to use Hibernate as the default persistence provider without specifying <provider>org.hibernate.ejb.HibernatePersistence</provider>?
I'm going to have a look at it, so if someone already did it, I'd be delighted to have some insights :).
Cheers.
Posted by Batmat on June 24, 2008 at 09:32 AM PDT #
rffsf
Posted by Eldar on August 28, 2008 at 03:47 AM PDT #
Hi,
We are using JPA with Hibernate and Glassfish 9.0.
Hibernate log all debug and Info.We dont want all the things. How to configure the logging level of hibernate properties in glassfish.
Posted by Sankar on September 02, 2008 at 07:11 PM PDT #
Hi Sanakar,
Hibernate uses log4j as its logging framework. Please refer to Hibernate documentation to configure logging level.
Thanks,
Posted by Mitesh Meswani on September 03, 2008 at 04:35 PM PDT #
This is the list of jars to be placed into glassfish/lib directory for latest Hibernate release (hibernate-entitymanager-3.4.0.GA and hibernate-distribution-3.3.1.GA):
antlr-2.7.6.jar
commons-collections-3.1.jar
dom4j-1.6.1.jar
ejb3-persistence.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-entitymanager.jar
hibernate3.jar
javassist.jar
jta-1.1.jar
log4j.jar
slf4j-api-1.5.2.jar
slf4j-log4j12.jar
Note that the last jar is located under hibernate-entitymanager-3.4.0.GA/lib/test
Posted by Marina Vatkina on October 28, 2008 at 03:07 PM PDT #