您好,发现了问题,我首先在c3p0上加上 调试信息的配置 :
c3p0.debugUnreturnedConnectionStackTraces=true
c3p0.unreturnedConnectionTimeout=90 (我的连接超时时间是60s,所以这设置了90s)
applicationContext数据源配置增加响应配置
果然发现很多未回收的连接,正常情况下超时未回收的连接会有一些,但是不会这么多啊。
经查资料在hibernate sessionFacory中增加配置(http://hi.baidu.com/austincao/item/fc9907da3d854e44fa576861)
Spring3.1去掉了HibernateDaoSupport类。hibernate4需要通过getCurrentSession()获取session。 并且设置
在Spring @Transactional声明式事务管理,”currentSession”的定义为: 当前被 Spring事务管理器 管理的Session,此时应配置:
hibernate.current_session_context_class=org.springframework.orm.hibernate4.SpringSessionContext。
另外在hibernate中使用 sessionFactory.getCurrentSession()获取session时,需要为方法声明事务,为此将sqlserver。