<?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">
<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 -->

    <property name="show_sql">false</property>
    <property name="use_outer_join">true</property>

    <property name="dbcp.defaultAutoCommit">false</property>
    <property name="dbcp.maxActive">50</property>
    <property name="dbcp.maxIdle">5</property>
    <property name="dbcp.maxWait">30000</property>
    <property name="dbcp.whenExhaustedAction">1</property>
    <property name="dbcp.ps.whenExhaustedAction">1</property>
    <property name="dbcp.ps.maxActive">20</property>
    <property name="dbcp.ps.maxWait">120000</property>
    <property name="dbcp.ps.maxIdle">20</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>

    <!-- 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.
    <property name="connection.url">jdbc:hsqldb:file:database/xwiki_db;shutdown=true</property>
    <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>
    <property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
    <property name="connection.pool_size">2</property>
    <property name="statement_cache.size">2</property>
    <mapping resource="xwiki.hbm.xml"/>
    <mapping resource="feeds.hbm.xml"/>
    <mapping resource="activitystream.hbm.xml"/>
    -->

    <!-- MySQL configuration.
         Uncomment if you want to use MySQL and comment out other database configurations.
    <property name="connection.url">jdbc:mysql://localhost/xwiki?useServerPrepStmts=false&amp;useUnicode=true&amp;characterEncoding=UTF-8</property>
    <property name="connection.username">xwiki</property>
    <property name="connection.password">xwiki</property>
    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
    <property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
    <property name="connection.pool_size">2</property>
    <property name="statement_cache.size">2</property>
    <mapping resource="xwiki.hbm.xml"/>
    <mapping resource="feeds.hbm.xml"/>
    <mapping resource="activitystream.hbm.xml"/>
    -->

    <!-- HSQLDB configuration.
         Uncomment if you want to use HSQLDB and comment out other database configurations.
    <property name="connection.url">jdbc:hsqldb:file:/some/path/xwikidb;shutdown=true</property>
    <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>
    <property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
    <property name="connection.pool_size">2</property>
    <property name="statement_cache.size">2</property>
    <mapping resource="xwiki.hbm.xml"/>
    <mapping resource="feeds.hbm.xml"/>
    <mapping resource="activitystream.hbm.xml"/>
    -->

    <!-- 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
    -->

    <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="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
    <property name="connection.pool_size">2</property>
    <property name="statement_cache.size">2</property>
    <property name="jdbc.use_streams_for_binary">false</property>
    <mapping resource="xwiki.postgresql.hbm.xml"/>
    <mapping resource="feeds.hbm.xml"/>
    <mapping resource="activitystream.hbm.xml"/>

    <!-- 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". They 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

    <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.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
    <property name="connection.pool_size">2</property>
    <property name="statement_cache.size">2</property>
    <property name="connection.SetBigStringTryClob">true</property>
    <property name="jdbc.batch_size">0</property>
    <property name="jdbc.use_streams_for_binary">false</property>
    <mapping resource="xwiki.oracle.hbm.xml"/>
    <mapping resource="feeds.oracle.hbm.xml"/>
    <mapping resource="activitystream.hbm.xml"/>
    -->

    <!-- Derby configuration.
         Uncomment if you want to use Derby and comment out other database configurations.
    <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="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
    <property name="connection.pool_size">2</property>
    <property name="statement_cache.size">2</property>
    <mapping resource="xwiki.derby.hbm.xml"/>
    <mapping resource="feeds.hbm.xml"/>
    <mapping resource="activitystream.hbm.xml"/>
    -->

  </session-factory>
</hibernate-configuration>
