commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanimir Komitov <stani...@devbg.piranko.com>
Subject Re: Problem with maxActive connections
Date Mon, 28 Jul 2008 15:40:53 GMT
This is my transaction management xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
	<bean id="txManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="testSessionFactory"/>
	</bean>
	<tx:advice id="txAdvice" transaction-manager="txManager">
		<tx:attributes>
			<tx:method name="save*" propagation="REQUIRED"
				read-only="false" />
			<tx:method name="update*" propagation="REQUIRED"
				read-only="false" />
			<tx:method name="delete*" propagation="REQUIRED"
				read-only="false" />	
			<tx:method name="load*" propagation="REQUIRED"
				read-only="true" />
		</tx:attributes>
	</tx:advice>
	
	<aop:config>
		<aop:pointcut id="testDaoOperation"
			expression="execution(* org.xxx.xxx.daos.TestDAO.*(..))" />
		<aop:advisor advice-ref="txAdvice" pointcut-ref="testDaoOperation" />
	</aop:config>
	
</beans>

James Carman wrote:
> You're not managing your Hibernate sessions properly.  You need to
> make sure you close it (which will close the db connection too or at
> least return it to the pool).  However, I would look into using
> declarative transaction management if you're using Spring.  The
> transaction management code will take care of opening/closing the
> session for you.
> 
> On Mon, Jul 28, 2008 at 11:23 AM, Stanimir Komitov
> <stanimir@devbg.piranko.com> wrote:
>> Hi,
>>
>> Why every time when I call HibernateDaoSupport
>> Session.().createSQLQuery(...)... and the SharedPoolDataSource makes new
>> one active connection, and never close it, then my maxActive
>> connections expired and throws the exception 'Timeout waiting for idle
>> object'?
>>
>> My configuration parameters are those:
>>
>> driver=org.postgresql.Driver
>> url=jdbc:postgresql://xxx.xxx.xxx.xxx/xxx
>> user=xxxxxxx
>> password=xxxxxx
>> maxActive=10
>> maxIdle=8
>> maxWait=2000
>> testOnBorrow=true
>> validationQuery=select 1
>> timeBetweenEvictionRunsMillis=300000
>>
>> but when I`m using HibernateTemplate in the same HibernateDaoSupport the
>> connections are managed fine and the maxActive connections did not expired!
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message