對(duì)于不喜歡使用Glassfish的原配持久層支持(TopLink)的朋友。現(xiàn)在可以替換調(diào)他了,下面屈指可數(shù)的幾步告訴我們?nèi)绾问褂胔ibernate來(lái)持久化數(shù)據(jù)。偏愛(ài)Hibernate的用戶也給 Glassfish一個(gè)機(jī)會(huì)哦
Use Hibernate as a persistence provider with Glassfish
from http://blogs.sun.com/roller/page/GlassFishPersistence#use_hibernate_as_a_persistence?
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.