Advertisement
ericparent

Example of "hibernate.cfg.xml"

Jan 23rd, 2012
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.89 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. <property name="dbcp.defaultAutoCommit">false</property>
  43. <property name="dbcp.maxActive">50</property>
  44. <property name="dbcp.maxIdle">5</property>
  45. <property name="dbcp.maxWait">30000</property>
  46. <property name="dbcp.whenExhaustedAction">1</property>
  47. <property name="dbcp.ps.whenExhaustedAction">1</property>
  48. <property name="dbcp.ps.maxActive">20</property>
  49. <property name="dbcp.ps.maxWait">120000</property>
  50. <property name="dbcp.ps.maxIdle">20</property>
  51. <!-- Without it, some queries fail in MS SQL. XWiki doesn't need scrollable result sets, anyway. -->
  52. <property name="jdbc.use_scrollable_resultset">false</property>
  53.  
  54. <!-- Configuration for the default database.
  55. Comment out this section and uncomment other sections below if you want to use another database.
  56. Note that the database tables will be created automatically if they don't already exist.
  57. -->
  58.  
  59. <!--
  60. <property name="connection.url">jdbc:hsqldb:file:database/xwiki_db;shutdown=true</property>
  61. <property name="connection.username">sa</property>
  62. <property name="connection.password"></property>
  63. <property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
  64. <property name="dialect">org.hibernate.dialect.HSQLDialect</property>
  65. <property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
  66. <property name="connection.pool_size">2</property>
  67. <property name="statement_cache.size">2</property>
  68. <mapping resource="xwiki.hbm.xml"/>
  69. <mapping resource="feeds.hbm.xml"/>
  70. <mapping resource="activitystream.hbm.xml"/>
  71.  
  72. -->
  73.  
  74. <!-- MySQL configuration.
  75. Uncomment if you want to use MySQL and comment out other database configurations. -->
  76. <property name="connection.url">jdbc:mysql://localhost/xwiki?useServerPrepStmts=false&amp;useUnicode=true&amp;characterEncoding=UTF-8</property>
  77. <property name="connection.username">xwiki</property>
  78. <property name="connection.password">xwiki</property>
  79. <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
  80. <property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
  81. <property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
  82. <property name="connection.pool_size">2</property>
  83. <property name="statement_cache.size">2</property>
  84. <mapping resource="xwiki.hbm.xml"/>
  85. <mapping resource="feeds.hbm.xml"/>
  86. <mapping resource="activitystream.hbm.xml"/>
  87. <!-- MySQL configuration -->
  88.  
  89. <!-- HSQLDB configuration.
  90. Uncomment if you want to use HSQLDB and comment out other database configurations.
  91. <property name="connection.url">jdbc:hsqldb:file:/some/path/xwikidb;shutdown=true</property>
  92. <property name="connection.username">sa</property>
  93. <property name="connection.password"></property>
  94. <property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
  95. <property name="dialect">org.hibernate.dialect.HSQLDialect</property>
  96. <property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
  97. <property name="connection.pool_size">2</property>
  98. <property name="statement_cache.size">2</property>
  99. <mapping resource="xwiki.hbm.xml"/>
  100. <mapping resource="feeds.hbm.xml"/>
  101. <mapping resource="activitystream.hbm.xml"/>
  102. -->
  103.  
  104. <!-- PostgreSQL configuration.
  105. Uncomment if you want to use PostgreSQL and comment out other database configurations.
  106. <property name="connection.url">jdbc:postgresql:xwiki</property>
  107. <property name="connection.username">xwiki</property>
  108. <property name="connection.password">xwiki</property>
  109. <property name="connection.driver_class">org.postgresql.Driver</property>
  110. <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
  111. <property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
  112. <property name="connection.pool_size">2</property>
  113. <property name="statement_cache.size">2</property>
  114. <mapping resource="xwiki.hbm.xml"/>
  115. <mapping resource="feeds.hbm.xml"/>
  116. <mapping resource="activitystream.hbm.xml"/>
  117. -->
  118.  
  119. <!-- Oracle configuration.
  120. Uncomment if you want to use Oracle and comment out other database configurations.
  121. Note: the 2 properties named "hibernate.connection.SetBigStringTryClob" and
  122. "hibernate.jdbc.batch_size". They are required to tell Oracle to allow CLOBs larger than
  123. 32K.
  124. <property name="connection.url">jdbc:oracle:thin:@localhost:1521:XE</property>
  125. <property name="connection.username">xwiki</property>
  126. <property name="connection.password">xwiki</property>
  127. <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
  128. <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
  129. <property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
  130. <property name="connection.pool_size">2</property>
  131. <property name="statement_cache.size">2</property>
  132. <property name="hibernate.connection.SetBigStringTryClob">true</property>
  133. <property name="hibernate.jdbc.batch_size">0</property>
  134. <mapping resource="xwiki.oracle.hbm.xml"/>
  135. <mapping resource="feeds.oracle.hbm.xml"/>
  136. <mapping resource="activitystream.hbm.xml"/>
  137. -->
  138.  
  139. <!-- Derby configuration.
  140. Uncomment if you want to use Derby and comment out other database configurations.
  141. <property name="connection.url">jdbc:derby:/some/path/xwikidb;create=true</property>
  142. <property name="connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
  143. <property name="dialect">org.hibernate.dialect.DerbyDialect</property>
  144. <property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
  145. <property name="connection.pool_size">2</property>
  146. <property name="statement_cache.size">2</property>
  147. <mapping resource="xwiki.derby.hbm.xml"/>
  148. <mapping resource="feeds.hbm.xml"/>
  149. <mapping resource="activitystream.hbm.xml"/>
  150. -->
  151.  
  152. </session-factory>
  153. </hibernate-configuration>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement