The first step is to add Hibernate libraries in #glassfish_home#/lib . Those libraries are:
All these libraries are distributed with Hibernate on this web page: http://hibernate.org/6.html. There are even more libraries available, but the set above was compiled by an attempt/error approach, which was indeed a tough task. You have to restart Glassfish in order to use those new libraries.
The next step is to create a connection pool and a JDBC resource, but I will assume that you know how to do that or you have read a post like the one written by Jagadish.
Finally, you have to configure your persistence unit in order to use Hibernate. See parts of my persistence.xml file below:
Basically, you have to set the provider tag with
org.hibernate.ejb.HibernatePersistence and set some properties according to specific needs. That’s all!