Dear list,
I'd like to share my fix with you after being stuck with this problem for 2 days...
Table 3.4 of the Hibernate v3 reference doc states that the property
hibernate.connection.release_mode is set to
on_close by default. However, while inspecting the Hibernate classes I noticed that this property was set to
after_transaction. This setting prevented Hibernate from releasing its SQL connections so that the connection pool couldn't recycle them. After explicitly setting this property to
on_close Hibernate released the connections appropriately.
I use Hibernate v3.1 and my Spring
applicationContext.xml reads as follows:
Code:
...
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="mappingResources">
<list>
<value>aMapping.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.connection.release_mode">on_close</prop>
</props>
</property>
<property name="dataSource">
<ref bean="hibernateDataSource" />
</property>
</bean>
<bean id="hibernateDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/happi" />
</bean>
...
Kind regards,
Bas Cancrinus -
www.iprofs.nl