67,513
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/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/mlm?useUnicode=true&characterEncoding=UTF-8</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password"></property>
<!--指定连接的语言-->
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">false</property> <!--是否将运行期生成的SQL输出到日志以供调试-->
<property name="hibernate.hbm2ddl.auto">validate</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">30</property><!--最大连接数-->
<property name="hibernate.c3p0.timeout">1800</property><!--连接超时时间-->
<property name="hibernate.c3p0.max_statements">100</property><!--statemnets缓存大小-->
<!--每隔多少秒检测连接是否可正常使用 -->
<!--为hibernate配置连接池,推荐用c3p0,然后配置c3p0的反空闲设置idle_test_period,-->
<!--(只要小于MySQL的wait timeout即可,这句话后经证实不一定)。 -->
<property name="hibernate.c3p0.idle_test_period">121</property>
<!--当池中的连接耗尽的时候,一次性增加的连接数量,默认为3-->
<property name="hibernate.c3p0.acquire_increment">1</property>
<property name="hibernate.c3p0.validate">true</property>
<!--映射资源-->
<mapping resource="hb/domain/Comment.hbm.xml" />
<!-- Survey -->
<mapping resource="hb/domain/survey/SurveyQuestion.hbm.xml" />
</session-factory>
</hibernate-configuration>