Advertisement
Guest User

Hibernate config

a guest
Jul 17th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 12.69 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. <!--
  4. * See the NOTICE file distributed with this work for additional
  5. * information regarding copyright ownership.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. -->
  22.  
  23. <!DOCTYPE hibernate-configuration PUBLIC
  24.  "-//Hibernate/Hibernate Configuration DTD//EN"
  25.  "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
  26. <hibernate-configuration>
  27.   <session-factory>
  28.  
  29.     <!-- Please refer to the installation guide on
  30.         http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Installation for configuring your
  31.         database. You'll need to do 2 things:
  32.         1) Copy your database driver JAR in WEB-INF/lib or in some shared lib directory
  33.         2) Uncomment the properties below for your specific DB (and comment the default
  34.            database configuration if it doesn't match your DB)
  35.    -->
  36.  
  37.     <!-- Generic parameters common to all Databases -->
  38.  
  39.     <property name="show_sql">false</property>
  40.     <property name="use_outer_join">true</property>
  41.  
  42.     <!-- Without it, some queries fail in MS SQL. XWiki doesn't need scrollable result sets, anyway. -->
  43.     <property name="jdbc.use_scrollable_resultset">false</property>
  44.  
  45.     <!-- DBCP Connection Pooling configuration. Only some properties are shown. All available properties can be found
  46.         at http://commons.apache.org/proper/commons-dbcp/configuration.html
  47.    -->
  48.     <property name="dbcp.defaultAutoCommit">false</property>
  49.     <property name="dbcp.maxTotal">50</property>
  50.     <property name="dbcp.maxIdle">5</property>
  51.     <property name="dbcp.maxWaitMillis">30000</property>
  52.     <property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
  53.  
  54.     <!-- Setting "dbcp.poolPreparedStatements" to true and "dbcp.maxOpenPreparedStatements" will tell DBCP to cache
  55.         Prepared Statements (it's off by default). Note that for backward compatibility the "dbcp.ps.maxActive" is also
  56.         supported and when set it'll set "dbcp.poolPreparedStatements" to true and "dbcp.maxOpenPreparedStatements" to
  57.         value of "dbcp.ps.maxActive".
  58.  
  59.         Note 1: When using HSQLDB for example, it's important to NOT cache prepared statements because HSQLDB
  60.         Prepared Statements (PS) contain the schema on which they were initially created and thus when switching
  61.         schema if the same PS is reused it'll execute on the wrong schema! Since HSQLDB does internally cache
  62.         prepared statement there's no performance loss by not caching Prepared Statements at the DBCP level.
  63.         See https://jira.xwiki.org/browse/XWIKI-1740.
  64.         Thus we recommend not turning on this configuration for HSQLDB unless you know what you're doing :)
  65.  
  66.         Note 2: The same applies to PostGreSQL.
  67.    -->
  68.  
  69.     <!-- BoneCP Connection Pooling configuration.
  70.    <property name="bonecp.idleMaxAgeInMinutes">240</property>
  71.    <property name="bonecp.idleConnectionTestPeriodInMinutes">60</property>
  72.    <property name="bonecp.partitionCount">3</property>
  73.    <property name="bonecp.acquireIncrement">10</property>
  74.    <property name="bonecp.maxConnectionsPerPartition">60</property>
  75.    <property name="bonecp.minConnectionsPerPartition">20</property>
  76.    <property name="bonecp.statementsCacheSize">50</property>
  77.    <property name="bonecp.releaseHelperThreads">3</property>
  78.    <property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
  79.    -->
  80.  
  81.  
  82.     <!-- Configuration for the default database.
  83.         Comment out this section and uncomment other sections below if you want to use another database.
  84.         Note that the database tables will be created automatically if they don't already exist.
  85.  
  86.         If you want the main wiki database to be different than "xwiki" (or the default schema for schema based engines)
  87.         you will also have to set the property xwiki.db in xwiki.cfg file
  88.    -->
  89.     <!-- property name="connection.url">jdbc:hsqldb:file:${environment.permanentDirectory}/database/xwiki_db;shutdown=true</property-->
  90.     <property name="connection.url">jdbc:mysql://localhost/xwiki</property>
  91.     <property name="connection.username">xwiki</property>
  92.     <property name="connection.password">xwiki</property>
  93.     <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
  94.     <property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
  95.     <property name="connection.useUnicode">true</property>
  96.     <property name="connection.characterEncoding">UTF-8</property>
  97.    
  98.    <!-- <property name="connection.username">sa</property>
  99.    <property name="connection.password"></property>
  100.    <property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
  101.    <property name="dialect">org.hibernate.dialect.HSQLDialect</property>
  102.  
  103.    <property name="hibernate.connection.charSet">UTF-8</property>
  104.    <property name="hibernate.connection.useUnicode">true</property>
  105.    <property name="hibernate.connection.characterEncoding">utf8</property>
  106.    -->
  107.  
  108.     <mapping resource="xwiki.hbm.xml"/>
  109.     <mapping resource="feeds.hbm.xml"/>
  110.     <mapping resource="activitystream.hbm.xml"/>
  111.     <mapping resource="instance.hbm.xml"/>
  112.     <mapping resource="mailsender.hbm.xml"/>
  113.  
  114.     <!-- MySQL configuration.
  115.         Uncomment if you want to use MySQL and comment out other database configurations.
  116.         Notes:
  117.           - if you want the main wiki database to be different than "xwiki"
  118.             you will also have to set the property xwiki.db in xwiki.cfg file
  119.            
  120.  
  121.    <property name="connection.url">jdbc:mysql://localhost/xwiki?useSSL=false</property>
  122.    <property name="connection.username">xwiki</property>
  123.    <property name="connection.password">xwiki</property>
  124.    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
  125.    <property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
  126.    <property name="dbcp.poolPreparedStatements">true</property>
  127.    <property name="dbcp.maxOpenPreparedStatements">20</property>
  128.    <mapping resource="xwiki.hbm.xml"/>
  129.    <mapping resource="feeds.hbm.xml"/>
  130.    <mapping resource="activitystream.hbm.xml"/>
  131.    <mapping resource="instance.hbm.xml"/>
  132.    <mapping resource="mailsender.hbm.xml"/>
  133.    
  134.    -->
  135.    
  136.  
  137.     <!-- HSQLDB configuration.
  138.         Uncomment if you want to use HSQLDB and comment out other database configurations.
  139.         Notes:
  140.           - if you want the main wiki schema to be different than "PUBLIC" (the default HSQLDB schema)
  141.             you will also have to set the property xwiki.db in xwiki.cfg file
  142.  
  143.    <property name="connection.url">jdbc:hsqldb:file:${environment.permanentDirectory}/database/xwiki_db;shutdown=true</property>
  144.    <property name="connection.username">sa</property>
  145.    <property name="connection.password"></property>
  146.    <property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
  147.    <property name="dialect">org.hibernate.dialect.HSQLDialect</property>
  148.    <mapping resource="xwiki.hbm.xml"/>
  149.    <mapping resource="feeds.hbm.xml"/>
  150.    <mapping resource="activitystream.hbm.xml"/>
  151.    <mapping resource="instance.hbm.xml"/>
  152.    <mapping resource="mailsender.hbm.xml"/>
  153.    -->
  154.  
  155.     <!-- PostgreSQL configuration.
  156.         Uncomment if you want to use PostgreSQL and comment out other database configurations.
  157.         Notes:
  158.           - "jdbc.use_streams_for_binary" needs to be set to "false",
  159.             see https://community.jboss.org/wiki/HibernateCoreMigrationGuide36
  160.           - "xwiki.virtual_mode" can be set to either "schema" or "database". Note that currently the database mode
  161.             doesn't support database creation (see https://jira.xwiki.org/browse/XWIKI-8753)
  162.           - if you want the main wiki database to be different than "xwiki" (or "public" in schema mode)
  163.             you will also have to set the property xwiki.db in xwiki.cfg file
  164.  
  165.    <property name="connection.url">jdbc:postgresql://localhost:5432/xwiki</property>
  166.    <property name="connection.username">xwiki</property>
  167.    <property name="connection.password">xwiki</property>
  168.    <property name="connection.driver_class">org.postgresql.Driver</property>
  169.    <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
  170.    <property name="jdbc.use_streams_for_binary">false</property>
  171.    <property name="xwiki.virtual_mode">schema</property>
  172.    <mapping resource="xwiki.postgresql.hbm.xml"/>
  173.    <mapping resource="feeds.hbm.xml"/>
  174.    <mapping resource="activitystream.hbm.xml"/>
  175.    <mapping resource="instance.hbm.xml"/>
  176.    <mapping resource="mailsender.hbm.xml"/>
  177.    -->
  178.  
  179.     <!-- Oracle configuration.
  180.         Uncomment if you want to use Oracle and comment out other database configurations.
  181.         Notes:
  182.           - the 2 properties named "connection.SetBigStringTryClob" and
  183.             "jdbc.batch_size" are required to tell Oracle to allow CLOBs larger than 32K.
  184.           - "jdbc.use_streams_for_binary" needs to be set to "false",
  185.             see https://community.jboss.org/wiki/HibernateCoreMigrationGuide36
  186.           - if you want the main wiki schema to be different than "xwiki"
  187.             you will also have to set the property xwiki.db in xwiki.cfg file
  188.  
  189.    <property name="connection.url">jdbc:oracle:thin:@localhost:1521:XE</property>
  190.    <property name="connection.username">xwiki</property>
  191.    <property name="connection.password">xwiki</property>
  192.    <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
  193.    <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
  194.    <property name="connection.SetBigStringTryClob">true</property>
  195.    <property name="jdbc.batch_size">0</property>
  196.    <property name="jdbc.use_streams_for_binary">false</property>
  197.    <property name="dbcp.poolPreparedStatements">true</property>
  198.    <property name="dbcp.maxOpenPreparedStatements">20</property>
  199.    <mapping resource="xwiki.oracle.hbm.xml"/>
  200.    <mapping resource="feeds.oracle.hbm.xml"/>
  201.    <mapping resource="activitystream.hbm.xml"/>
  202.    <mapping resource="instance.hbm.xml"/>
  203.    <mapping resource="mailsender.oracle.hbm.xml"/>
  204.    -->
  205.  
  206.     <!-- Derby configuration.
  207.         Uncomment if you want to use Derby and comment out other database configurations.
  208.         Notes:
  209.           - if you want the main wiki schema to be different than "APP" (the default Derby schema)
  210.             you will also have to set the property xwiki.db in xwiki.cfg file
  211.  
  212.    <property name="connection.url">jdbc:derby:/some/path/xwikidb;create=true</property>
  213.    <property name="connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
  214.    <property name="dialect">org.hibernate.dialect.DerbyDialect</property>
  215.    <property name="dbcp.poolPreparedStatements">true</property>
  216.    <property name="dbcp.maxOpenPreparedStatements">20</property>
  217.    <mapping resource="xwiki.derby.hbm.xml"/>
  218.    <mapping resource="feeds.hbm.xml"/>
  219.    <mapping resource="activitystream.hbm.xml"/>
  220.    <mapping resource="instance.hbm.xml"/>
  221.    <mapping resource="mailsender.hbm.xml"/>
  222.    -->
  223.  
  224.     <!-- H2 configuration.
  225.         Uncomment if you want to use H2 and comment out other database configurations.
  226.         Notes:
  227.           - if you want the main wiki schema to be different than "PUBLIC" (the default H2 schema)
  228.             you will also have to set the property xwiki.db in xwiki.cfg file
  229.  
  230.    <property name="connection.url">jdbc:h2:${environment.permanentDirectory}/database/xwiki</property>
  231.    <property name="connection.username">sa</property>
  232.    <property name="connection.password"></property>
  233.    <property name="connection.driver_class">org.h2.Driver</property>
  234.    <property name="dialect">org.hibernate.dialect.H2Dialect</property>
  235.    <mapping resource="xwiki.hbm.xml"/>
  236.    <mapping resource="feeds.hbm.xml"/>
  237.    <mapping resource="activitystream.hbm.xml"/>
  238.    <mapping resource="instance.hbm.xml"/>
  239.    <mapping resource="mailsender.hbm.xml"/>
  240.    -->
  241.  
  242.   </session-factory>
  243. </hibernate-configuration>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement