Sun GlassFish Web Space Server 10.0 Administration Guide

Hibernate

Hibernate is a property in the portal.properties file, which is the default configuration file for Sun GlassFish Web Space Server. You can override this property using portal-ext.properties file.

Many of the following properties should only be customized if you have advanced knowledge of Hibernate. They map to various Hibernate configuration options which themselves have detailed documentation. Please see http://www.hibernate.org for more information.

Input a list of comma-delimited Hibernate configurations.


hibernate.configs=\
META-INF/counter-hbm.xml,\
META-INF/mail-hbm.xml,\
META-INF/portal-hbm.xml,\
META-INF/ext-hbm.xml

Use the Liferay SQL dialect because it will automatically detect the proper SQL dialect based on your connection URL.


hibernate.dialect=com.liferay.portal.dao.orm.hibernate.DynamicDialect

Set the Hibernate connection release mode. You should not modify this unless you know what you're doing. The default setting works best for Spring managed transactions. See the method buildSessionFactory in class org.springframework.orm.hibernate3.LocalSessionFactoryBean and search for the phrase "on_close" to understand how this works.


hibernate.connection.release_mode=on_close

Set the Hibernate cache provider. Ehcache is recommended in a clustered environment. See the property net.sf.ehcache.configurationResourceName for detailed configuration.

Examples:


hibernate.cache.provider_class=com.liferay.portal.dao.orm.hibernate.EhCacheProvider
hibernate.cache.provider_class=net.sf.hibernate.cache.HashtableCacheProvider
hibernate.cache.provider_class=com.liferay.portal.dao.orm.hibernate.OSCacheProvider

This property is used if Hibernate is configured to use Ehcache's cache provider.


net.sf.ehcache.configurationResourceName=/ehcache/hibernate.xml

Use the following ehcache configuration in a clustered environment.


net.sf.ehcache.configurationResourceName=/ehcache/hibernate-clustered.xml

Set other Hibernate cache settings.


hibernate.cache.use_query_cache=true
hibernate.cache.use_second_level_cache=true
hibernate.cache.use_minimal_puts=true
hibernate.cache.use_structured_entries=false

Use these properties to disable Hibernate caching. This may be a performance hit; you may only want to use these properties for diagnostic purposes.


hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider
hibernate.cache.use_query_cache=false
hibernate.cache.use_second_level_cache=false

Set the JDBC batch size to improve performance. If you're using Oracle 9i, however, you must set the batch size to 0 as a workaround for a hanging bug in the Oracle driver. See http://support.liferay.com/browse/LEP-1234 for more information.

Examples:


hibernate.jdbc.batch_size=20
hibernate.jdbc.batch_size=0

Set other miscellaneous Hibernate properties.


hibernate.jdbc.use_scrollable_resultset=true
hibernate.bytecode.use_reflection_optimizer=true
hibernate.show_sql=false

Use the classic query factory until WebLogic and Hibernate 3 can get along. See http://www . hibernate .org/250 . html #A23 for more information.


hibernate.query.factory_class=org.hibernate.hql.classic.ClassicQueryTranslatorFactory