<?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.dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- 基本四项 -->
<propertyname="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql:///test</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<!-- 数据库连接池C3P0的使用 -->
<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<!-- 连接池中最小连接数 -->
<property name="hibernate.c3p0.min_size">5</property>
<!-- 连接池中最大连接数 -->
<property name="hibernate.c3p0.max_size">20</property>
<!-- 当连接不够用时候每次的增量 -->
<property name="hibernate.c3p0.acquire_increment">2</property>
<!-- 设定数据库连接超时时间,以秒为单位。如果连接池中某个数据库连接处于空闲状态且超过timeout秒时,就会从连接池中移除-->
<property name="hibernate.c3p0.timeout">120</property>
<!-- 显示SQL语句 -->
<property name="hibernate.show_sql">true</property>
<!-- 格式化SQL语句 -->
<property name="hibernate.format_sql">true</property>
<!-- 每次都先删除表,再创建新表 -->
<property name="hibernate.hbm2ddl.auto">create</property>
<!-- 配置Session的创建方式,
线程方式创建 config.getCurrentSession() -->
<property name="hibernate.current_session_context_class">thread</property>
<!-- 关联hbm配置文件 -->
<mapping resourcce="laplace/entity/User.hbm.xml" />
</session-factory>
</hibernate-configuration>
09-14
09-14
09-14
09-14
08-30