Hibernate主配置文件hibernate.cfg.cml详解
来源:互联网 发布:python黑帽子 python3 编辑:程序博客网 时间:2024/05/21 04:16
</pre><pre name="code" class="html"><!DOCTYPE hibernate-configuration PUBLIC"-//Hibernate/Hibernate Configuration DTD 3.0//EN""http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"><hibernate-configuration><session-factory name="foo"><!-- 配置数据库信息 --> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> 方言<property name="connection.url">jdbc:mysql:///hibernate_20120328</property> <span style="font-family:Arial, Helvetica, sans-serif;"> <span style="white-space:pre"></span>url</span><property name="connection.driver_class">com.mysql.jdbc.Driver</property> <span style="white-space:pre"></span> 驱动<property name="connection.username">root</property><span style="white-space:pre"></span>用户名<property name="hibernate.connection.password">root</property><span style="white-space:pre"></span>密码<!-- 其他配置 --><property name="hibernate.show_sql">true</property> <span style="white-space:pre"></span>现实sql语句<property name="hibernate.format_sql">false</property><span style="white-space:pre"></span>格式化sql语句<!--
<span style="white-space:pre"></span>自动建表create:先删除,再创建update:如果表不存在就创建,不一样就更新,一样就什么都不做。create-drop:初始化时创建表,SessionFactory执行close()时删除表。validate:验证表结构是否一致,如果不一致,就抛异常。
--><property name="hbm2ddl.auto">update</property><!-- 设置默认的事务隔离级别:隔离级别对应的整数表示READ UNCOMMITED1READ COMMITED2REPEATABLE READ4SERIALIZEABLE8 --><property name="connection.isolation">2</property><!-- C3P0连接池设定--><!-- 使用c3p0连接池 配置连接池提供的供应商--><property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider </property><!--在连接池中可用的数据库连接的最少数目 --><property name="c3p0.min_size">5</property><!--在连接池中所有数据库连接的最大数目 --><property name="c3p0.max_size">20</property><!--设定数据库连接的过期时间,以秒为单位,如果连接池中的某个数据库连接处于空闲状态的时间超过了timeout时间,就会从连接池中清除 --><property name="c3p0.timeout">120</property> <!--每3000秒检查所有连接池中的空闲连接 以秒为单位--><property name="c3p0.idle_test_period">3000</property><!-- 使用二级缓存,默认是未打开的。 --><!-- 指定要使用的缓存的提供商,这也就打开了二级缓存 <property name="cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>--><property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property><!-- 开启使用查询缓存 --><property name="cache.use_query_cache">true</property><!-- 指定要使用二级缓存的实体类 --><class-cache usage="read-write" class="cn.itcast.l_second_cache.Employee"/><class-cache usage="read-write" class="cn.itcast.l_second_cache.Department"/><collection-cache usage="read-write" collection="cn.itcast.l_second_cache.Department.employees"/><!-- 导入映射文件 <mapping resource="cn/itcast/a_helloworld/User.hbm.xml"/>--></session-factory></hibernate-configuration>
0 0
- Hibernate主配置文件hibernate.cfg.cml详解
- hibernate.cfg.cml的最基础配置
- hibernate.cfg.xml配置文件详解
- hibernate.cfg.xml配置文件详解
- hibernate.cfg.xml配置文件详解
- hibernate.cfg.xml配置文件详解
- hibernate.cfg.xml配置文件详解
- hibernate.cfg.xml配置文件详解
- hibernate.cfg.xml配置文件详解
- 【Hibernate】Hibernate.cfg.xml配置文件详解
- Hibernate中配置文件hibernate.cfg.xml详解
- Hibernate学习--配置文件hibernate.cfg.xml详解
- Hibernate配置文件hibernate.cfg.xml的详解
- Hibernate主配置文件(hibernate.cfg.xml)
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- 不同服务器数据库之间的数据操作,数据同步
- 回文词(UVa401)
- C++中负数的位操作
- 电脑常识和电脑常见故障
- java面向对象三大特征之多态
- Hibernate主配置文件hibernate.cfg.cml详解
- 基于Sublime Text搭建Python IDE
- 2.2.3 X Window的学习
- SSM:spring+springmvc+mybatis框架中的XML配置文件功能详细解释
- Docker的镜像和容器的区别
- 故障案例--mongodb添加副本集成员报错
- DOM事件处理
- 栈的操作
- Kylin正式发布:面向大数据的终极OLAP引擎方案