SSH框架的项目在訪问数据库的时候。訪问完毕后一直占用链接,不释放。导致过了一段时间后,server没挂,就是有訪问数据库的连接是时候。一直卡住
解决的方法:
?
1.配置spring相应的hibernate文件:
?????????? after_statement 事务提交后自己主动释放连接
2配置事务
????
?
??class="org.springframework.orm.hibernate3.HibernateTransactionManager">
??
?
?
?
??class="org.springframework.transaction.interceptor.TransactionInterceptor">
??
??
???
????
????PROPAGATION_REQUIRED,readOnly
????PROPAGATION_REQUIRED,readOnly
????PROPAGATION_REQUIRED,readOnly
????PROPAGATION_REQUIRED,readOnly
????PROPAGATION_REQUIRED,readOnly
????
????PROPAGATION_REQUIRED
???
??
?
?
?
??class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
??
???
????*Impl
???
??
??
??
???true
??
??
??
???
????transactionInterceptor
???
??
?
?