hibernate.cfg.xml配置文件

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <!DOCTYPE hibernate-configuration PUBLIC
 3     "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
 4     "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
 5 <hibernate-configuration>
 6     <!-- JDBC基本连接参数 -->
 7 <session-factory><!-- 理解为连接池 -->
 8     <property name="hibernate.connection.driver_class">
 9         com.mysql.jdbc.Driver
10     </property>
11     <property name="hibernate.connection.url">
12         jdbc:mysql:///hibernate01
13     </property>
14     <property name="hibernate.connection.username">root</property>
15     <property name="hibernate.connection.password">root</property>
16     
17     <!-- c3p0 -->
18     <property name="hibernate"></property>
19     
20     <!-- 配置方言 告诉hibernate 框架当前你的数据库是mysql  -->
21     <property name="hibernate.dialect">
22         org.hibernate.dialect.MySQLDialect
23     </property>
24 
25     <!-- 常见其它配置 -->
26     <property name="hibernate.show_sql">true</property>
27     <!-- 控制台上打印SQL -->
28     <property name="hibernate.format_sql">true</property>
29     <!-- 控制台输出时,对SQL语句格式化 -->
30     <!-- 测试环境 create/ create-drop 正式环境 update validate -->
31     <!-- <property name="hibernate.hbm2ddl.auto">update</property> -->
32     <!-- 自动建表 -->
33 
34     <!-- 控制事务管理的 每一条sql 都是一个事务 默认true 事务自动提交 -->
35 <!--      <property name="hibernate.connection.autocommit">true</property>  -->
36 
37     <!-- 在核心配置文件中 引用 mapping 映射文件  必须要写  resource 值 User.hbm.xml 文件的工程路径-->
38     <mapping resource="cn/lsp/hibernate/domain/User.hbm.xml" />
39 </session-factory>
40 </hibernate-configuration>    
原文地址:https://www.cnblogs.com/yunmengxiaohe/p/3921579.html