• No results found

H IBERNATE

In document Portal Administrator's Guide (Page 156-160)

The portal-ext.properties File

H IBERNATE

Many of the following properties should only be customized if you have ad- vanced 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

Liferay will automatically detect the Hibernate dialect in com.liferay.portal.spring.-

PortalHibernateConfiguration. Set this property to manually override the automatically

detected dialect. #hibernate.dialect=

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.hi-

bernate3.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 envir- onment. See the property net.sf.ehcache.configurationResourceName for detailed config- uration. 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 #hibernate.cache.provider_class= \ com.liferay.portal.dao.orm.hibernate.TerracottaCacheProvider

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

Uncomment the following in a Terracotta environment.

#net.sf.ehcache.configurationResourceName=/ehcache/hibernate-terracotta.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 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.ClassicQueryTrans- latorFactory

Set this property to true to enable Hibernate cache monitoring. See LPS-2056 for more information.

hibernate.generate_statistics=false

JDBC

Set the JNDI name to lookup the JDBC data source. If none is set, then the portal will attempt to create the JDBC data source based on the properties prefixed with jdb-

c.default.

#jdbc.default.jndi.name=jdbc/LiferayPool

Set the properties used to create the JDBC data source. These properties will only be read if the property jdbc.default.jndi.name is not set.

The default settings are configured for an in-memory database called Hypersonic that is not recommended for production use. Please change the properties to use an- other database.

Add dynamic-data-source-spring.xml to the property spring.configs to configure the portal to use one database cluster for read calls and another database cluster for write calls. The convention is to create a set of properties prefixed with jdbc.read. to handle read calls and another set of properties prefixed with jdbc.write. to handle write calls. These data sources can also be created via JNDI by setting the properties

jdbc.read.jndi.name and jdbc.write.jndi.name.

DB2

jdbc.default.driverClassName=com.ibm.db2.jcc.DB2Driver jdbc.default.url=jdbc:db2:lportal jdbc.default.username=db2admin jdbc.default.password=lportal

D

ERBY jdbc.default.driverClassName=org.apache.derby.jdbc.EmbeddedDriver jdbc.default.url=jdbc:derby:lportal jdbc.default.username= jdbc.default.password=

H

YPERSONIC jdbc.default.driverClassName=org.hsqldb.jdbcDriver jdbc.default.url=jdbc:hsqldb:${liferay.home}/data/hsql/lportal jdbc.default.username=sa jdbc.default.password= MySQL jdbc.default.driverClassName=com.mysql.jdbc.Driver jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEn- coding=UTF-8&useFastDateParsing=false jdbc.default.username= jdbc.default.password=

O

RACLE jdbc.default.driverClassName=oracle.jdbc.driver.OracleDriver jdbc.default.url=jdbc:oracle:thin:@localhost:1521:xe jdbc.default.username=lportal jdbc.default.password=lportal

P6S

PY jdbc.default.driverClassName=com.p6spy.engine.spy.P6SpyDriver jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEn- coding=UTF-8&useFastDateParsing=false jdbc.default.username= jdbc.default.password=

P

OSTGRE

SQL

jdbc.default.driverClassName=org.postgresql.Driver jdbc.default.url=jdbc:postgresql://localhost:5432/lportal jdbc.default.username=sa jdbc.default.password=

SQL S

ERVER jdbc.default.driverClassName=net.sourceforge.jtds.jdbc.Driver jdbc.default.url=jdbc:jtds:sqlserver://localhost/lportal jdbc.default.username=sa jdbc.default.password=

S

YBASE jdbc.default.driverClassName=net.sourceforge.jtds.jdbc.Driver jdbc.default.url=jdbc:jtds:sybase://localhost:5000/lportal jdbc.default.username=sa jdbc.default.password=

Liferay uses C3PO by default for connection pooling. The data source factory can be configured to use JNDI or another pooling implementation by modifying infra- structure-spring.xml. See http://www.mchange.com/projects/c3p0/index. html con- figuration for a list of additional fields used by C3PO for configuring the database con- nection.

jdbc.default.maxPoolSize=50 jdbc.default.minPoolSize=5

In document Portal Administrator's Guide (Page 156-160)