hibernate框架主配置文件

<!--  hibernate.cfg.xml -->

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"

"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

<!-- 这里以mysql数据库为例 -->

<hibernate-configuration>

<session-factory>

                <!-- 必配配置 -->

<!-- 数据库驱动 -->

<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>


<!-- 数据库url -->

<property name="hibernate.connection.url">xxxxxx</property>


<!-- 数据库连接用户名 -->

<property name="hibernate.connection.username">xxxxxx</property>


<!-- 数据库连接密码 -->

<property name="hibernate.connection.password">xxxxxx</property>


<!-- 数据库方言 不同的数据库中,sql语法略有区别. 指定方言可以让hibernate框架在生成sql语句时.针对数据库的方                    言生成. 注意: MYSQL在选择方言时,请选择最短的方言,因为适用范围最广-->
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>

                <!-- 可选配置 -->
<!-- 将hibernate生成的sql语句打印到控制台  默认是false-->

<property name="hibernate.show_sql">true</property>


<!-- 将hibernate生成的sql语句格式化(语法缩进)  默认是false-->

<property name="hibernate.format_sql">true</property>


<!-- 可选update、delete 、all-->

<property name="hibernate.hbm2ddl.auto">update</property>


<!-- 指定hibernate操作数据库的隔离级别  1|2|3|4 0001 1 读未提交 0010 2 读已提交 0100 4 可重复读 1000 8 串行                  化 -->

<property name="hibernate.connection.isolation">4</property>


<!-- 指定session与当前线程绑定 -->

<property name="hibernate.current_session_context_class">thread</property>

                <!-- 实体映射关系配置文件,后续会更新讲解 -->

<!-- 引入orm元数据 路径书写: 填写src下的路径 -->
<mapping resource="com/heima/domain/Customer.hbm.xml" />
<mapping resource="com/heima/domain/LinkMan.hbm.xml" />

</session-factory>
</hibernate-configuration>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值