Jpa2/hibernate c3p0 pool configuration lead connection and thread leaks
I am trying to use c3p0 as connection pool provider in my application (jpa 2 and hibernate core 3.3.2) but c3p0 getting too much connection from database.This is same problem but answer not helped.I am getting entitymanager from entitymanager factory and storing entitymanager in a thread local variable,thus a am using a fresh entiymanager for each request.(by the way if i use hibernate default pool no problem)
<property name="hibernate.connection.provider_class"
value="org.hibernate.connection.C3P0ConnectionProvider" />
<property name="hibernate.c3p0.min_size" value="1" />
<property name="hibernate.c3p0.max_size" value="10" />
<property name="hibernate. c3p0.initialPoolSize" value="3" />
<property name="hibernate.c3p0.numHelperThreads" value="3" />
<property name="hibernate.c3p0.maxPoolSize" value="10" />
<property name="hibernate.c3p0.minPoolSize" value="1" />
<property name="hibernate.c3p0.maxIdleTime" value="3600" />
<property name="hibernate.c3p0.maxIdleTimeExcessConnections" value="300" />
<property name="hibernate.c3p0.unreturnedConnectionTimeout" value="3600" />
<property name="hibernate.c3p0.acquire_increment" value="1" />
<property name="hibernate.c3p0.idle_test_period" value="3000" />
<property name="hibernate.c3p0.max_statements" value="0" />
<property name="hibernate.c3p0.timeout" value="300" />
<property name="hibernate.c3p0.breakAfterAcquireFailure" value="false" />
<property name="hibernate.c3p0.acquireRetryAttempts"开发者_C百科 value="1" />
<property name="hibernate.c3p0.acquireRetryDelay" value="100" / >
Can you ensure that you are not defining pool at both datasource and sessionFactory level.
精彩评论