二十一 串讲Hibernate配置文件中的配置项

数据源配置

 ## JNDI Datasource

#hibernate.connection.datasource jdbc/test
#hibernate.connection.username db2
#hibernate.connection.password db2

Hibernate连接池连接数

hibernate.connection.pool_size 1

配置c3p0数据源

#hibernate.c3p0.max_size 2

#hibernate.c3p0.min_size 2
#hibernate.c3p0.timeout 5000
#hibernate.c3p0.max_statements 100
#hibernate.c3p0.idle_test_period 3000
#hibernate.c3p0.acquire_increment 2
#hibernate.c3p0.validate false

选择JTA或者JDBC

#hibernate.transaction.factory_class org.hibernate.transaction.JTATransactionFactory
#hibernate.transaction.factory_class org.hibernate.transaction.JDBCTransactionFactory


##jta事务配置支持
#jta.UserTransaction jta/usertransaction
#jta.UserTransaction javax.transaction.UserTransaction
#jta.UserTransaction UserTransaction

删除时候id回滚

#hibernate.use_identifer_rollback true

jdbc自动提交

#hibernate.connection.autocommit true

JDBC最大抓取量

#hibernate.jdbc.fetch_size 25

二进制数据流处理

hibernate.jdbc.use_streams_for_binary true


##连接提供者
## use a custom ConnectionProvider (if not set, Hibernate will choose a built-in ConnectionProvider using hueristics)

#hibernate.connection.provider_class org.hibernate.connection.DriverManagerConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.DatasourceConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.C3P0ConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.ProxoolConnectionProvider


## print all generated SQL to the console
##显示sql配置
#hibernate.show_sql true


## format SQL in log and console

hibernate.format_sql true


## add comments to the generated SQL

#hibernate.use_sql_comments true

##产生统计的配置
## generate statistics

#hibernate.generate_statistics true


## auto schema export
##hibernate建表策略
#hibernate.hbm2ddl.auto create-drop
#hibernate.hbm2ddl.auto create
#hibernate.hbm2ddl.auto update
#hibernate.hbm2ddl.auto validate


##配置二级缓存提供者信息
## choose a cache implementation

#hibernate.cache.provider_class org.hibernate.cache.EhCacheProvider
#hibernate.cache.provider_class org.hibernate.cache.EmptyCacheProvider
hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
#hibernate.cache.provider_class org.hibernate.cache.TreeCacheProvider
#hibernate.cache.provider_class org.hibernate.cache.OSCacheProvider
#hibernate.cache.provider_class org.hibernate.cache.SwarmCacheProvider


完毕 end!

 

你可能感兴趣的:(Hibernate)