Is it possible to use hibernate as Glassfish's persistence provider and if so HOW?
While I'm not an expert on either Glassfish or Hibernate, I think you'd probably find this interesting: Instructions on using Hibernte in Glassfish
Yes, that's a common scenario. Just deploy Hibernate (and all its dependencies) either globally into Glassfish or as part of your application. Then implement your application using Hibernate as a library.
The next question you have to consider is whether you want to use JPA, and Hibernate as JPA provider or if you want to use Hibernate plain.
Another question then if you want to use EJBs and Entity Beans. If yes, I would recomend using JPA.
If you are not using EJB Entity Beans, you can use either JPA or plain Hibernate for persisting your POJOs.
The link provided by Guss to hibernate.org has expired. Here's a google cache dated Feb 20, 2010. As noted in a previous version of the linked wiki page, it is preferable to keep the hibernate libraries within your .ear / .war rather than the Glassfish install dir so that different applications can use their own version of Hibernate.
Modern How-To
To use hibernate with glassfish, all you have to do is put hibernate and its dependencies into your EAR file. This might also with with a WAR file.
In your persistence.xml, specify hibernate using this tag:
<provider>org.hibernate.ejb.HibernatePersistence</provider>
You can also specify hibernate properties as usual, for example:
<properties> <property name="hibernate.hbm2ddl.auto" value="none"/> </properties>