hibernate 配置文件(hibernate.properties)基本模板

来源:互联网 发布:左程云 算法 编辑:程序博客网 时间:2024/04/30 02:01
 
  1. ######################
  2. ### Query Language ###
  3. ######################
  4. ## define query language constants / function names
  5. hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
  6. ## select the classic query parser
  7. #hibernate.query.factory_class org.hibernate.hql.classic.ClassicQueryTranslatorFactory
  8. hibernate.format_sql true
  9. #################
  10. ### Platforms ###
  11. #################
  12. ## JNDI Datasource
  13. #hibernate.connection.datasource jdbc/test
  14. #hibernate.connection.username db2
  15. #hibernate.connection.password db2
  16. ## HypersonicSQL
  17. hibernate.dialect org.hibernate.dialect.HSQLDialect
  18. hibernate.connection.driver_class org.hsqldb.jdbcDriver
  19. hibernate.connection.username sa
  20. hibernate.connection.password
  21. hibernate.connection.url jdbc:hsqldb:hsql://localhost
  22. hibernate.connection.url jdbc:hsqldb:test
  23. hibernate.connection.url jdbc:hsqldb:.
  24. ## MySQL
  25. #hibernate.dialect org.hibernate.dialect.MySQLDialect
  26. #hibernate.dialect org.hibernate.dialect.MySQLInnoDBDialect
  27. #hibernate.dialect org.hibernate.dialect.MySQLMyISAMDialect
  28. #hibernate.connection.driver_class com.mysql.jdbc.Driver
  29. #hibernate.connection.url jdbc:mysql:///test
  30. #hibernate.connection.username emmanuel
  31. #hibernate.connection.password hibernate
  32. ## Oracle
  33. #hibernate.dialect org.hibernate.dialect.OracleDialect
  34. #hibernate.dialect org.hibernate.dialect.Oracle9Dialect
  35. #hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
  36. #hibernate.connection.username ora
  37. #hibernate.connection.password ora
  38. #hibernate.connection.url jdbc:oracle:thin:@localhost:1521:test
  39. ## PostgreSQL
  40. #hibernate.dialect org.hibernate.dialect.PostgreSQLDialect
  41. #hibernate.connection.driver_class org.postgresql.Driver
  42. #hibernate.connection.url jdbc:postgresql:annotations
  43. #hibernate.connection.username postgres
  44. #hibernate.connection.password hibernate
  45. #hibernate.query.substitutions yes 'Y', no 'N'
  46. ## DB2
  47. #hibernate.dialect org.hibernate.dialect.DB2Dialect
  48. #hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
  49. #hibernate.connection.url jdbc:db2:test
  50. #hibernate.connection.username db2
  51. #hibernate.connection.password db2
  52. ## TimesTen (not supported yet)
  53. #hibernate.dialect org.hibernate.dialect.TimesTenDialect
  54. #hibernate.connection.driver_class com.timesten.jdbc.TimesTenDriver
  55. #hibernate.connection.url jdbc:timesten:direct:test
  56. #hibernate.connection.username
  57. #hibernate.connection.password 
  58. ## DB2/400
  59. #hibernate.dialect org.hibernate.dialect.DB2400Dialect
  60. #hibernate.connection.username user
  61. #hibernate.connection.password password
  62. ## Native driver
  63. #hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
  64. #hibernate.connection.url jdbc:db2://systemname
  65. ## Toolbox driver
  66. #hibernate.connection.driver_class com.ibm.as400.access.AS400JDBCDriver
  67. #hibernate.connection.url jdbc:as400://systemname
  68. ## Derby (Not supported!)
  69. #hibernate.dialect org.hibernate.dialect.DerbyDialect
  70. #hibernate.connection.driver_class org.apache.derby.jdbc.EmbeddedDriver
  71. #hibernate.connection.username
  72. #hibernate.connection.password
  73. #hibernate.connection.url jdbc:derby:/test;create=true
  74. ## Sybase
  75. #hibernate.dialect org.hibernate.dialect.SybaseDialect
  76. #hibernate.connection.driver_class com.sybase.jdbc2.jdbc.SybDriver
  77. #hibernate.connection.username sa
  78. #hibernate.connection.password sasasa
  79. #hibernate.connection.url jdbc:sybase:Tds:co3061835-a:5000/tempdb
  80. ## Mckoi SQL
  81. #hibernate.dialect org.hibernate.dialect.MckoiDialect
  82. #hibernate.connection.driver_class com.mckoi.JDBCDriver
  83. #hibernate.connection.url jdbc:mckoi:///
  84. #hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.00/db.conf
  85. #hibernate.connection.username admin
  86. #hibernate.connection.password nimda
  87. ## SAP DB
  88. #hibernate.dialect org.hibernate.dialect.SAPDBDialect
  89. #hibernate.connection.driver_class com.sap.dbtech.jdbc.DriverSapDB
  90. #hibernate.connection.url jdbc:sapdb://localhost/TST
  91. #hibernate.connection.username TEST
  92. #hibernate.connection.password TEST
  93. #hibernate.query.substitutions yes 'Y', no 'N'
  94. ## MS SQL Server
  95. #hibernate.dialect org.hibernate.dialect.SQLServerDialect
  96. #hibernate.connection.username sa
  97. #hibernate.connection.password sa
  98. ## JSQL Driver
  99. #hibernate.connection.driver_class com.jnetdirect.jsql.JSQLDriver
  100. #hibernate.connection.url jdbc:JSQLConnect://1E1/test
  101. ## JTURBO Driver
  102. #hibernate.connection.driver_class com.newatlanta.jturbo.driver.Driver
  103. #hibernate.connection.url jdbc:JTurbo://1E1:1433/test
  104. ## WebLogic Driver
  105. #hibernate.connection.driver_class weblogic.jdbc.mssqlserver4.Driver
  106. #hibernate.connection.url jdbc:weblogic:mssqlserver4:1E1:1433
  107. ## Microsoft Driver (not recommended!)
  108. #hibernate.connection.driver_class com.microsoft.jdbc.sqlserver.SQLServerDriver
  109. #hibernate.connection.url jdbc:microsoft:sqlserver://1E1;DatabaseName=test;SelectMethod=cursor
  110. ## jTDS (since version 0.9)
  111. #hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
  112. #hibernate.connection.url jdbc:jtds:sqlserver://1E1/test
  113. ## Interbase
  114. #hibernate.dialect org.hibernate.dialect.InterbaseDialect
  115. #hibernate.connection.username sysdba
  116. #hibernate.connection.password masterkey
  117. ## DO NOT specify hibernate.connection.sqlDialect
  118. ## InterClient
  119. #hibernate.connection.driver_class interbase.interclient.Driver
  120. #hibernate.connection.url jdbc:interbase://localhost:3060/C:/firebird/test.gdb
  121. ## Pure Java
  122. #hibernate.connection.driver_class org.firebirdsql.jdbc.FBDriver
  123. #hibernate.connection.url jdbc:firebirdsql:localhost/3050:/firebird/test.gdb
  124. ## Pointbase
  125. #hibernate.dialect org.hibernate.dialect.PointbaseDialect
  126. #hibernate.connection.driver_class com.pointbase.jdbc.jdbcUniversalDriver
  127. #hibernate.connection.url jdbc:pointbase:embedded:sample
  128. #hibernate.connection.username PBPUBLIC
  129. #hibernate.connection.password PBPUBLIC
  130. #################################
  131. ### Hibernate Connection Pool ###
  132. #################################
  133. hibernate.connection.pool_size 1
  134. ###########################
  135. ### C3P0 Connection Pool###
  136. ###########################
  137. #hibernate.c3p0.max_size 2
  138. #hibernate.c3p0.min_size 2
  139. #hibernate.c3p0.timeout 5000
  140. #hibernate.c3p0.max_statements 100
  141. #hibernate.c3p0.idle_test_period 3000
  142. #hibernate.c3p0.acquire_increment 2
  143. #hibernate.c3p0.validate false
  144. ##############################
  145. ### Proxool Connection Pool###
  146. ##############################
  147. ## Properties for external configuration of Proxool
  148. hibernate.proxool.pool_alias pool1
  149. ## Only need one of the following
  150. #hibernate.proxool.existing_pool true
  151. #hibernate.proxool.xml proxool.xml
  152. #hibernate.proxool.properties proxool.properties
  153. #################################
  154. ### Plugin ConnectionProvider ###
  155. #################################
  156. ## use a custom ConnectionProvider (if not set, Hibernate will choose a built-in ConnectionProvider using hueristics)
  157. #hibernate.connection.provider_class org.hibernate.connection.DriverManagerConnectionProvider
  158. #hibernate.connection.provider_class org.hibernate.connection.DatasourceConnectionProvider
  159. #hibernate.connection.provider_class org.hibernate.connection.C3P0ConnectionProvider
  160. #hibernate.connection.provider_class org.hibernate.connection.DBCPConnectionProvider
  161. #hibernate.connection.provider_class org.hibernate.connection.ProxoolConnectionProvider
  162. #######################
  163. ### Transaction API ###
  164. #######################
  165. ## Enable automatic flush during the JTA beforeCompletion() callback
  166. ## (This setting is relevant with or without the Transaction API)
  167. #hibernate.transaction.flush_before_completion
  168. ## Enable automatic session close at the end of transaction
  169. ## (This setting is relevant with or without the Transaction API)
  170. #hibernate.transaction.auto_close_session
  171. ## the Transaction API abstracts application code from the underlying JTA or JDBC transactions
  172. #hibernate.transaction.factory_class org.hibernate.transaction.JTATransactionFactory
  173. #hibernate.transaction.factory_class org.hibernate.transaction.JDBCTransactionFactory
  174. ## to use JTATransactionFactory, Hibernate must be able to locate the UserTransaction in JNDI
  175. ## default is java:comp/UserTransaction
  176. ## you do NOT need this setting if you specify hibernate.transaction.manager_lookup_class
  177. #jta.UserTransaction jta/usertransaction
  178. #jta.UserTransaction javax.transaction.UserTransaction
  179. #jta.UserTransaction UserTransaction
  180. ## to use the second-level cache with JTA, Hibernate must be able to obtain the JTA TransactionManager
  181. #hibernate.transaction.manager_lookup_class org.hibernate.transaction.JBossTransactionManagerLookup
  182. #hibernate.transaction.manager_lookup_class org.hibernate.transaction.WeblogicTransactionManagerLookup
  183. #hibernate.transaction.manager_lookup_class org.hibernate.transaction.WebSphereTransactionManagerLookup
  184. #hibernate.transaction.manager_lookup_class org.hibernate.transaction.OrionTransactionManagerLookup
  185. #hibernate.transaction.manager_lookup_class org.hibernate.transaction.ResinTransactionManagerLookup
  186. ##############################
  187. ### Miscellaneous Settings ###
  188. ##############################
  189. ## print all generated SQL to the console
  190. #hibernate.show_sql true
  191. ## add comments to the generated SQL
  192. #hibernate.use_sql_comments true
  193. ## generate statistics
  194. #hibernate.generate_statistics true
  195. ## auto schema export
  196. #hibernate.hbm2ddl.auto create-drop
  197. #hibernate.hbm2ddl.auto create
  198. #hibernate.hbm2ddl.auto update
  199. ## specify a default schema and catalog for unqualified tablenames
  200. #hibernate.default_schema test
  201. #hibernate.default_catalog test
  202. ## enable ordering of SQL UPDATEs by primary key
  203. hibernate.order_updates true
  204. ## set the maximum depth of the outer join fetch tree
  205. hibernate.max_fetch_depth 1
  206. ## set the default batch size for batch fetching
  207. hibernate.default_batch_fetch_size 100
  208. ## rollback generated identifier values of deleted entities to default values
  209. #hibernate.use_identifer_rollback true
  210. ## enable CGLIB reflection optimizer (enabled by default)
  211. #hibernate.cglib.use_reflection_optimizer false
  212. #####################
  213. ### JDBC Settings ###
  214. #####################
  215. ## specify a JDBC isolation level
  216. #hibernate.connection.isolation 4
  217. ## enable JDBC autocommit (not recommended!)
  218. #hibernate.connection.autocommit true
  219. ## set the JDBC fetch size
  220. #hibernate.jdbc.fetch_size 25
  221. ## set the maximum JDBC 2 batch size (a nonzero value enables batching)
  222. #hibernate.jdbc.batch_size 0
  223. ## enable batch updates even for versioned data
  224. hibernate.jdbc.batch_versioned_data true
  225. ## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will cause Hibernate to use a sensible default)
  226. #hibernate.jdbc.use_scrollable_resultset true
  227. ## use streams when writing binary types to / from JDBC
  228. hibernate.jdbc.use_streams_for_binary true
  229. ## use JDBC 3 PreparedStatement.getGeneratedKeys() to get the identifier of an inserted row
  230. #hibernate.jdbc.use_get_generated_keys false
  231. ## choose a custom JDBC batcher
  232. # hibernate.jdbc.factory_class
  233. ## enable JDBC result set column alias caching 
  234. ## (minor performance enhancement for broken JDBC drivers)
  235. # hibernate.jdbc.wrap_result_sets
  236. ## choose a custom SQL exception converter
  237. #hibernate.jdbc.sql_exception_converter
  238. ##########################
  239. ### Second-level Cache ###
  240. ##########################
  241. ## optimize chache for minimal "puts" instead of minimal "gets" (good for clustered cache)
  242. #hibernate.cache.use_minimal_puts true
  243. ## set a prefix for cache region names
  244. hibernate.cache.region_prefix hibernate.test
  245. ## disable the second-level cache
  246. #hibernate.cache.use_second_level_cache false
  247. ## enable the query cache
  248. hibernate.cache.use_query_cache true
  249. ## store the second-level cache entries in a more human-friendly format
  250. #hibernate.cache.use_structured_entries true
  251. ## choose a cache implementation
  252. #hibernate.cache.provider_class org.hibernate.cache.EhCacheProvider
  253. #hibernate.cache.provider_class org.hibernate.cache.EmptyCacheProvider
  254. hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
  255. #hibernate.cache.provider_class org.hibernate.cache.TreeCacheProvider
  256. #hibernate.cache.provider_class org.hibernate.cache.OSCacheProvider
  257. #hibernate.cache.provider_class org.hibernate.cache.SwarmCacheProvider
  258. ## choose a custom query cache implementation
  259. #hibernate.cache.query_cache_factory
  260. ############
  261. ### JNDI ###
  262. ############
  263. ## specify a JNDI name for the SessionFactory
  264. #hibernate.session_factory_name hibernate/session_factory
  265. ## Hibernate uses JNDI to bind a name to a SessionFactory and to look up the JTA UserTransaction;
  266. ## if hibernate.jndi.* are not specified, Hibernate will use the default InitialContext() which
  267. ## is the best approach in an application server
  268. #file system
  269. #hibernate.jndi.class com.sun.jndi.fscontext.RefFSContextFactory
  270. #hibernate.jndi.url file:/
  271. #WebSphere
  272. #hibernate.jndi.class com.ibm.websphere.naming.WsnInitialContextFactory
  273. #hibernate.jndi.url iiop://localhost:900/
原创粉丝点击