Hibernate version: 3.1rc2
Name and version of the database you are using: mysql 5
Hi, I'm currently migrating an application. This application used c3p0 to manage pooling. I try to implement hibernate but I don't find the equivalence between our precedent parameters and those we can use in hibernate.xml
Code:
// Config is a com.mchange.v2.c3p0.PoolConfig;
config.setInitialPoolSize(3); // 3 is the default for c3p0 anyway
// if > MaxPoolSize, it will be ignored - no worry
// (as said in c3p0 docs, it's only a suggestion
// how many connections to acquire to start with)
config.setAcquireRetryAttempts(0); // try to obtain connections indefinitely (0 = never quit)
config.setAcquireRetryDelay(500); // 500 miliseconds wait before try to acquire connection again
config.setCheckoutTimeout(0); // 0 = wait indefinitely for new connection
config.setAutomaticTestTable("connection_test_table");
config.setTestConnectionOnCheckin(true); //
config.setIdleConnectionTestPeriod(60); // test idle connection every 60 sec
config.setMaxStatementsPerConnection(100);
config.setMaxIdleTime(0); // 0 = idle connections never expire
config.setBreakAfterAcquireFailure(false); // never fail if any way possible
In hibernate.xml, I write this :
Code:
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.c3p0.min_size">1</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.acquire_increment">5</property>
<property name="hibernate.c3p0.autocommit">false</property>
<property name="hibernate.c3p0.max_statements">100</property>
<property name="hibernate.c3p0.timeout">0</property>
<!-- Test connection every 60 s -->
<property name="hibernate.c3p0.idle_test_period">60</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<!-- Show sql request -->
<property name="hibernate.show_sql">true</property>
I didn't found :
Code:
config.setAcquireRetryAttempts(0); // try to obtain connections indefinitely (0 = never quit)
config.setAcquireRetryDelay(500); // 500 miliseconds wait before try to acquire connection again
config.setAutomaticTestTable("connection_test_table"); // very very fast test, don't worry
config.setTestConnectionOnCheckin(true); // this will *not* make l2j slower in any way
config.setMaxIdleTime(0); // 0 = idle connections never expire
config.setBreakAfterAcquireFailure(false); // never fail if any way possible
ps : you can tell me if you find those parameters unusefull.