Newer
Older
<?xml version="1.0" encoding="UTF-8"?>
<!--
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
## Template for hibernate configuration. processing by maven using profiles.
## Replace original src/main/webapp/WEB-INF/hibernate.cfg.xml
Vincent Massol
committed
<hibernate-configuration>
<session-factory>
<!-- Please refer to the installation guide on
http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Installation for configuring your
database. You'll need to do 2 things:
1) Copy your database driver JAR in WEB-INF/lib or in some shared lib directory
2) Uncomment the properties below for your specific DB (and comment the default
database configuration if it doesn't match your DB)
-->
<!-- Generic parameters common to all Databases -->
Vincent Massol
committed
<property name="show_sql">false</property>
<property name="use_outer_join">true</property>
<!-- Without it, some queries fail in MS SQL. XWiki doesn't need scrollable result sets, anyway. -->
<property name="jdbc.use_scrollable_resultset">false</property>
<!-- DBCP Connection Pooling configuration. Only some properties are shown. All available properties can be found
at http://commons.apache.org/proper/commons-dbcp/configuration.html
Vincent Massol
committed
<property name="dbcp.defaultAutoCommit">false</property>
<property name="dbcp.maxTotal">50</property>
Vincent Massol
committed
<property name="dbcp.maxIdle">5</property>
<property name="dbcp.maxWaitMillis">30000</property>
<property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
<!-- Setting "dbcp.poolPreparedStatements" to true and "dbcp.maxOpenPreparedStatements" will tell DBCP to cache
Prepared Statements (it's off by default). Note that for backward compatibility the "dbcp.ps.maxActive" is also
supported and when set it'll set "dbcp.poolPreparedStatements" to true and "dbcp.maxOpenPreparedStatements" to
value of "dbcp.ps.maxActive".
Note 1: When using HSQLDB for example, it's important to NOT cache prepared statements because HSQLDB
Prepared Statements (PS) contain the schema on which they were initially created and thus when switching
schema if the same PS is reused it'll execute on the wrong schema! Since HSQLDB does internally cache
prepared statement there's no performance loss by not caching Prepared Statements at the DBCP level.
See http://jira.xwiki.org/browse/XWIKI-1740.
Thus we recommend not turning on this configuration for HSQLDB unless you know what you're doing :)
Note 2: The same applies to PostGreSQL.
-->
<!-- BoneCP Connection Pooling configuration.
<property name="bonecp.idleMaxAgeInMinutes">240</property>
<property name="bonecp.idleConnectionTestPeriodInMinutes">60</property>
<property name="bonecp.partitionCount">3</property>
<property name="bonecp.acquireIncrement">10</property>
<property name="bonecp.maxConnectionsPerPartition">60</property>
<property name="bonecp.minConnectionsPerPartition">20</property>
<property name="bonecp.statementsCacheSize">50</property>
<property name="bonecp.releaseHelperThreads">3</property>
<property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
## DO NOT USE XML COMMENT IN BETWEEN DB SPECIFIC CONFIGURATION, IT RENDER COMMENTING/UNCOMMENTING THE RIGHT
## CONFIGURATION A PAIN
Vincent Massol
committed
<!-- Configuration for the default database.
Comment out this section and uncomment other sections below if you want to use another database.
Note that the database tables will be created automatically if they don't already exist.
If you want the main wiki database to be different than "xwiki" (or the default schema for schema based engines)
you will also have to set the property xwiki.db in xwiki.cfg file
Vincent Massol
committed
-->
jvdrean
committed
## Only use a default configuration if the $xwikiDbConnectionUrl field equal to "none". I would
## have preferred to use an empty value but I couldn't make that work with Maven.
jvdrean
committed
#if ($xwikiDbConnectionUrl != "none")
Vincent Massol
committed
<property name="connection.url">$xwikiDbConnectionUrl</property>
<property name="connection.username">$!xwikiDbConnectionUsername</property>
Vincent Massol
committed
<property name="connection.password">$!xwikiDbConnectionPassword</property>
<property name="connection.driver_class">$xwikiDbConnectionDriverClass</property>
<property name="dialect">$xwikiDbDialect</property>
## Note: This is starting the line in order not to put extra spaces when generated
#if ($xwikiDb == 'mysql' || $xwikiDb == 'oracle')
<property name="dbcp.poolPreparedStatements">true</property>
<property name="dbcp.maxOpenPreparedStatements">20</property>
#end
## Note: This is starting the line in order not to put extra spaces when generated
#if ($xwikiDbVirtualMode)
<property name="xwiki.virtual_mode">$xwikiDbVirtualMode</property>
#end
## Note: This is starting the line in order not to put extra spaces when generated
#if ($xwikiDb == 'pgsql' || $xwikiDb == 'oracle')
<property name="jdbc.use_streams_for_binary">false</property>
#end
## Note: This is starting the line in order not to put extra spaces when generated
#if ($xwikiDb == 'oracle')
<property name="connection.SetBigStringTryClob">true</property>
<property name="jdbc.batch_size">0</property>
#end
Thomas Mortagne
committed
<property name="hibernate.connection.charSet">UTF-8</property>
<property name="hibernate.connection.useUnicode">true</property>
<property name="hibernate.connection.characterEncoding">utf8</property>
<mapping resource="$xwikiDbHbmXwiki"/>
<mapping resource="$xwikiDbHbmFeeds"/>
## Note: This is starting the line in order not to put extra spaces when generated
#foreach($mapping in $!xwikiDbHbmCommonExtraMappings.split(","))
<mapping resource="$mapping"/>
jvdrean
committed
#end
## Note: This is starting the line in order not to put extra spaces when generated
#foreach($mapping in $!xwikiDbHbmDefaultExtraMappings.split(","))
<mapping resource="$mapping"/>
jvdrean
committed
#end
#end
Vincent Massol
committed
<!-- MySQL configuration.
Uncomment if you want to use MySQL and comment out other database configurations.
Notes:
- if you want the main wiki database to be different than "xwiki"
you will also have to set the property xwiki.db in xwiki.cfg file
<property name="connection.url">jdbc:mysql://localhost/xwiki?useSSL=false</property>
Vincent Massol
committed
<property name="connection.username">xwiki</property>
<property name="connection.password">xwiki</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
Sergiu Dumitriu
committed
<property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<property name="dbcp.poolPreparedStatements">true</property>
<property name="dbcp.maxOpenPreparedStatements">20</property>
Vincent Massol
committed
<mapping resource="xwiki.hbm.xml"/>
<mapping resource="feeds.hbm.xml"/>
## Note: This is starting the line in order not to put extra spaces when generated
#foreach($mapping in $!xwikiDbHbmCommonExtraMappings.split(","))
<mapping resource="$mapping"/>
jvdrean
committed
#end
## Note: This is starting the line in order not to put extra spaces when generated
#foreach($mapping in $!xwikiDbHbmMySQLExtraMappings.split(","))
<mapping resource="$mapping"/>
jvdrean
committed
#end
Vincent Massol
committed
-->
<!-- HSQLDB configuration.
Uncomment if you want to use HSQLDB and comment out other database configurations.
Notes:
- if you want the main wiki schema to be different than "PUBLIC" (the default HSQLDB schema)
you will also have to set the property xwiki.db in xwiki.cfg file
<property name="connection.url">jdbc:hsqldb:file:${environment.permanentDirectory}/database/xwiki_db;shutdown=true</property>
Vincent Massol
committed
<property name="connection.username">sa</property>
<property name="connection.password"></property>
<property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="dialect">org.hibernate.dialect.HSQLDialect</property>
<mapping resource="xwiki.hbm.xml"/>
<mapping resource="feeds.hbm.xml"/>
## Note: This is starting the line in order not to put extra spaces when generated
#foreach($mapping in $!xwikiDbHbmCommonExtraMappings.split(","))
<mapping resource="$mapping"/>
jvdrean
committed
#end
## Note: This is starting the line in order not to put extra spaces when generated
#foreach($mapping in $!xwikiDbHbmHSQLDBExtraMappings.split(","))
<mapping resource="$mapping"/>
jvdrean
committed
#end
-->
<!-- PostgreSQL configuration.
Uncomment if you want to use PostgreSQL and comment out other database configurations.
Notes:
- "jdbc.use_streams_for_binary" needs to be set to "false",
see https://community.jboss.org/wiki/HibernateCoreMigrationGuide36
- "xwiki.virtual_mode" can be set to either "schema" or "database". Note that currently the database mode
doesn't support database creation (see http://jira.xwiki.org/browse/XWIKI-8753)
- if you want the main wiki database to be different than "xwiki" (or "public" in schema mode)
you will also have to set the property xwiki.db in xwiki.cfg file
<property name="connection.url">jdbc:postgresql:xwiki</property>
<property name="connection.username">xwiki</property>
<property name="connection.password">xwiki</property>
<property name="connection.driver_class">org.postgresql.Driver</property>
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="jdbc.use_streams_for_binary">false</property>
<property name="xwiki.virtual_mode">schema</property>
Sergiu Dumitriu
committed
<mapping resource="xwiki.postgresql.hbm.xml"/>
Vincent Massol
committed
<mapping resource="feeds.hbm.xml"/>
## Note: This is starting the line in order not to put extra spaces when generated
#foreach($mapping in $!xwikiDbHbmCommonExtraMappings.split(","))
<mapping resource="$mapping"/>
jvdrean
committed
#end
## Note: This is starting the line in order not to put extra spaces when generated
#foreach($mapping in $!xwikiDbHbmPostgreSQLExtraMappings.split(","))
<mapping resource="$mapping"/>
jvdrean
committed
#end
Vincent Massol
committed
-->
<!-- Oracle configuration.
Uncomment if you want to use Oracle and comment out other database configurations.
Notes:
- the 2 properties named "connection.SetBigStringTryClob" and
"jdbc.batch_size" are required to tell Oracle to allow CLOBs larger than 32K.
- "jdbc.use_streams_for_binary" needs to be set to "false",
see https://community.jboss.org/wiki/HibernateCoreMigrationGuide36
- if you want the main wiki schema to be different than "xwiki"
you will also have to set the property xwiki.db in xwiki.cfg file
Vincent Massol
committed
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:XE</property>
<property name="connection.username">xwiki</property>
<property name="connection.password">xwiki</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="connection.SetBigStringTryClob">true</property>
<property name="jdbc.batch_size">0</property>
<property name="jdbc.use_streams_for_binary">false</property>
<property name="dbcp.poolPreparedStatements">true</property>
<property name="dbcp.maxOpenPreparedStatements">20</property>
Vincent Massol
committed
<mapping resource="xwiki.oracle.hbm.xml"/>
<mapping resource="feeds.oracle.hbm.xml"/>
## Note: This is starting the line in order not to put extra spaces when generated
#foreach($mapping in $!xwikiDbHbmCommonExtraMappings.split(","))
<mapping resource="$mapping"/>
jvdrean
committed
#end
## Note: This is starting the line in order not to put extra spaces when generated
#foreach($mapping in $!xwikiDbHbmOracleExtraMappings.split(","))
<mapping resource="$mapping"/>
jvdrean
committed
#end
Vincent Massol
committed
-->
<!-- Derby configuration.
Uncomment if you want to use Derby and comment out other database configurations.
Notes:
- if you want the main wiki schema to be different than "APP" (the default Derby schema)
you will also have to set the property xwiki.db in xwiki.cfg file
Vincent Massol
committed
<property name="connection.url">jdbc:derby:/some/path/xwikidb;create=true</property>
<property name="connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
<property name="dialect">org.hibernate.dialect.DerbyDialect</property>
<property name="dbcp.poolPreparedStatements">true</property>
<property name="dbcp.maxOpenPreparedStatements">20</property>
Vincent Massol
committed
<mapping resource="xwiki.derby.hbm.xml"/>
<mapping resource="feeds.hbm.xml"/>
## Note: This is starting the line in order not to put extra spaces when generated
#foreach($mapping in $!xwikiDbHbmCommonExtraMappings.split(","))
<mapping resource="$mapping"/>
jvdrean
committed
#end
## Note: This is starting the line in order not to put extra spaces when generated
#foreach($mapping in $!xwikiDbHbmDerbyExtraMappings.split(","))
<mapping resource="$mapping"/>
jvdrean
committed
#end
Vincent Massol
committed
-->
<!-- H2 configuration.
Uncomment if you want to use H2 and comment out other database configurations.
Notes:
- if you want the main wiki schema to be different than "PUBLIC" (the default H2 schema)
you will also have to set the property xwiki.db in xwiki.cfg file
<property name="connection.url">jdbc:h2:${environment.permanentDirectory}/database/xwiki</property>
<property name="connection.username">sa</property>
<property name="connection.password"></property>
<property name="connection.driver_class">org.h2.Driver</property>
<property name="dialect">org.hibernate.dialect.H2Dialect</property>
<mapping resource="xwiki.hbm.xml"/>
<mapping resource="feeds.hbm.xml"/>
## Note: This is starting the line in order not to put extra spaces when generated
#foreach($mapping in $!xwikiDbHbmCommonExtraMappings.split(","))
<mapping resource="$mapping"/>
#end
## Note: This is starting the line in order not to put extra spaces when generated
#foreach($mapping in $!xwikiDbHbmH2ExtraMappings.split(","))
<mapping resource="$mapping"/>
#end
-->
Vincent Massol
committed
</session-factory>
</hibernate-configuration>