<?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">
<hibernate-configuration>
<session-factory>
<!-- 指定驱动类名 -->
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- 指定链接地址 -->
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/hibernate</property>
<!-- 指定用户名 -->
<property name="hibernate.connection.username">root</property>
<!-- 指定密码 -->
<property name="hibernate.connection.password">123</property>
<!-- 指定方言 -->
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- 指定数据库链接池的提供商 -->
<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<!-- 指定最大链接数量 -->
<property name="hibernate.c3p0.max_size">20</property>
<!-- 最小链接数量 -->
<property name="hibernate.c3p0.min_size">5</property>
<!-- 指定链接的超时时间 -->
<property name="hibernate.c3p0.timeout">5000</property>
<!-- 指定每次间隔3000秒检测是否有链接超时 -->
<property name="hibernate.c3p0.idle_test_period">3000</property>
<!-- 指定显示sql语句 -->
<property name="hibernate.show_sql">true</property>
<!-- 指定格式sql语句 -->
<property name="hibernate.format_sql">true</property>
<!-- create:指定每次在加在hibernate框架时,先删除表结构,再建立表结构 create-drop:指定每次在加在hibernate框架时,先删除表结构,再建立表结构,当sf关闭时,删除表结构
update:指定每次在加在hibernate框架时,验证明体类和表结构是否一致,若是不一致,就更新表结构 validate:指定每次在加在hibernate框架时,验证明体类和表结构是否一致,若是不一致,就会报错 -->
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- 引入自定义的映射文件 -->
<mapping resource="cn/itcast/domain/Customer.hbm.xml" />
</session-factory>
</hibernate-configuration>mysql