`
cicl
  • 浏览: 45574 次
  • 性别: Icon_minigender_1
  • 来自: 未来
社区版块
存档分类
最新评论

配置c3p0

    博客分类:
  • java
阅读更多
在dataSource中添加
<property name="idleConnectionTestPeriod" value="600"/>
    <property name="preferredTestQuery" value="select id from BLOG_ARTICLE where id=1"/>
    <property name="testConnectionOnCheckin" value="true"/>
    <property name="testConnectionOnCheckout" value="true"/>

即:
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="idleConnectionTestPeriod" value="600"/>
    <property name="preferredTestQuery" value="select id from tableName where id=1"/>
    <property name="testConnectionOnCheckin" value="true"/>
    <property name="testConnectionOnCheckout" value="true"/>
</bean>

配置c3p0的目的是解决Could not open Hibernate Session for transaction问题,即mysql每隔八小时断开问题。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics