Rozwiązałem ten problem za pomocą c3p0
pula połączeń
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close" p:driverClass="${jdbc.driverClassName}"
p:jdbcUrl="${jdbc.url}" p:user="${jdbc.username}" p:password="${jdbc.password}"
p:preferredTestQuery="select 1 from dual" p:idleConnectionTestPeriod="300"
p:maxStatements="100" p:acquireRetryAttempts="1" p:checkoutTimeout="1000"
p:testConnectionOnCheckout="true" p:testConnectionOnCheckin="true"
p:acquireIncrement="${c3p0.acquire_increment}" p:minPoolSize="${c3p0.min_size}"
p:maxPoolSize="${c3p0.max_size}" p:maxIdleTime="${c3p0.max_idle_time}"
p:unreturnedConnectionTimeout="${c3p0.unreturned_connection_timeout}" />
plik DB.properties:
#hibernate
hibernate.dialect=org.hibernate.dialect.OracleDialect
hibernate.hbm2ddl.auto= update
hibernate.connection.autocommit = true
hibernate.cache = true
hibernate.query.cache = true
hibernate.statistics = true
hibernate.c3p0.idle_test_period=300
#c3p0 pool
c3p0.acquire_increment=5
c3p0.max_size=100
c3p0.min_size=5
c3p0.max_idle_time=1200
c3p0.unreturned_connection_timeout=120