- <?xml version='1.0' encoding='UTF-8'?>
- <!DOCTYPE hibernate-configuration PUBLIC
- "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
- <!-- Generated by MyEclipse Hibernate Tools. -->
- <hibernate-configuration>
- <session-factory>
- <!-- 连接数据库 -->
- <property name="connection.password">root</property>
- <property name="connection.username">root</property>
- <property name="connection.url">jdbc:mysql://127.0.0.1:3306/csts</property>
- <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
- <!-- 连接数据库 end-->
- <!--配置c3p0数据源 -->
- <property name="hibernate.c3p0.max_size">20</property>
- <!-- 最小连接数 -->
- <property name="hibernate.c3p0.min_size">5</property>
- <!-- 获得连接的超时时间,如果超过这个时间,会抛出异常,单位毫秒 -->
- <property name="hibernate.c3p0.timeout">11120</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">false</property>
- <!--配置c3p0数据源 end-->
- <!-- 配置数据库方言 -->
- <property name="dialect"> org.hibernate.dialect.MySQLDialect</property>
- <!-- 配置数据库方言end -->
- <!-- 配置打印语句 -->
- <property name="show_sql">true</property>
- <property name="format_sql">true</property>
- <!-- 配置打印语句 end-->
- <!-- 配置线程安全的session -->
- <property name="hibernate.current_session_context_class">thread</property>
- <!-- 配置线程安全的session end-->
- <!--<property name="hbm2ddl.auto">create</property> 如果表不存在,则会帮你新建-->
- <!-- 配置Entity -->
- <property name="myeclipse.connection.profile">mysql</property>
- <mapping class="com.csts.question.pojo.UserType" />
- <mapping resource="com/csts/question/userTyoe.hbm.xml" />
- </session-factory>
- </hibernate-configuration>
转载于:https://www.cnblogs.com/hing/p/3914915.html