SSH framework of the project when accessing the database, access after the completion of the link has been occupied, not released, resulting in a period of time after the server is not hanging, is the connection to access the database is the time, has been stuck
Workaround:
1. Configure the hibernate file for spring:
<prop key= "Hibernate.connection.release_mode" >after_statement</prop> automatically release connections after transaction commits
2 Configuring transactions
<!--Spring declarative transaction Manager--
<bean id= "TransactionManager"
class= "Org.springframework.orm.hibernate3.HibernateTransactionManager" >
<property name= "Sessionfactory" ref= "Sessionfactory"/>
</bean>
<!--spring transaction blocker--
<bean id= "Transactioninterceptor"
class= "Org.springframework.transaction.interceptor.TransactionInterceptor" >
<property name= "TransactionManager" ref= "TransactionManager"/>
<property name= "Transactionattributes" >
<props>
<!--all methods starting with browse, list, load, get, and is read-only transaction control type-
<prop key= "browse*" >PROPAGATION_REQUIRED,readOnly</prop>
<prop key= "list*" >PROPAGATION_REQUIRED,readOnly</prop>
<prop key= "load*" >PROPAGATION_REQUIRED,readOnly</prop>
<prop key= "get*" >PROPAGATION_REQUIRED,readOnly</prop>
<prop key= "is*" >PROPAGATION_REQUIRED,readOnly</prop>
<!--all methods are transaction controlled, and if there is no transaction, create a new transaction-
<prop key= "*" >PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!--Auto proxy class--
<bean
class= "Org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator" >
<property name= "Beannames" >
<list>
<value>*Impl</value>
</list>
</property>
<!--This property is true, it means that the proxy is the target class itself rather than the target class's interface--
<property name= "Proxytargetclass" >
<value>true</value>
</property>
<!--Dependency injection of the transaction interceptor defined above Transactioninterceptor--
<property name= "Interceptornames" >
<list>
<value>transactionInterceptor</value>
</list>
</property>
</bean>