Fuguo-db-hibernate4-config

来自ling
跳转至: 导航搜索

功能

  1. hibernate4的配置文件,根据实际部署需要更改
#hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
#hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
#hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
hibernate.connection.provider_class=org.hibernate.connection.C3P0ConnectionProvider
hibernate.cache.use_query_cache=true
hibernate.cache.use_second_level_cache=true
hibernate.jdbc.fetch_size=100
hibernate.jdbc.batch_size=50
hibernate.hbm2ddl.auto=update
#hibernate.hbm2ddl.auto=none
hibernate.show_sql=true
hibernate.format_sql=true

#hibernate3
#hibernate.cache.provider_class=net.sf.ehcache.hibernate.EhCacheProvider
#hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory
#hibernate.dataSource=org.springframework.jdbc.datasource.DriverManagerDataSource
#hibernate.sessionFactory=org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean
#hibernate.transactionManager=org.springframework.orm.hibernate3.HibernateTransactionManager
#hibernate.query.factory_class=org.hibernate.hql.ast.ASTQueryTranslatorFactory
#hibernate4
hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
hibernate.cache.region.factory_class=net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory
hibernate.dataSource=org.apache.commons.dbcp.BasicDataSource
hibernate.sessionFactory=org.springframework.orm.hibernate4.LocalSessionFactoryBean
hibernate.transactionManager=org.springframework.orm.hibernate4.HibernateTransactionManager
hibernate.query.factory_class=org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory
  1. hibernate.hbm2ddl.auto=update
  • 能将model中对表结构的定义同步到数据库中
  • 使用限制如下:
    1. 需要类型转换的需要手工更改数据库
    2. 字段从长改短的需要手工更改数据库

依赖

配置文件说明

关键类说明