0

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"     value="1"  />
         <property name="hibernate.c3p0.acquireRetryDelay"  value="100" / >
Community
  • 1
  • 1
ayengin
  • 1,606
  • 1
  • 22
  • 47

1 Answers1

0

Can you ensure that you are not defining pool at both datasource and sessionFactory level.

K.M
  • 154
  • 3
  • 11