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">

<hibernate-configuration>

	<session-factory>

		<!-- Database connection settings -->
		<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
		<property name="connection.url">jdbc:oracle:thin:@localhost:1521:ORCL</property>
		<property name="connection.username">HIBERNATE</property>
		<property name="connection.password">HIBERNATE</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">120</property>

		<!-- 最大的PreparedStatement的数量 -->
		<property name="hibernate.c3p0.max_statements">100</property>

		<!-- 每隔120秒检查连接池里的空闲连接 ,单位是秒 -->
		<property name="hibernate.c3p0.idle_test_period">120</property>

		<!-- 当连接池里面的连接用完的时候,C3P0一下获取的新的连接数 -->
		<property name="hibernate.c3p0.acquire_increment">2</property>

		<!-- 每次都验证连接是否可用 -->
		<property name="hibernate.c3p0.validate">true</property>

		<property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>

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

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

		<property name="jdbc.fetch_size">50</property>

		<mapping resource="com/animal/pojo/Animal.hbm.xml" />

	</session-factory>

</hibernate-configuration>



调试的时候,发现只创建了一个连接,可是上面的最小连接数是5啊,不解。