It looks like Hibernate is not able to set the hibernate.c3p0.max_statements property in my application. Here is my hibernateProperties from spring config
Code:
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.c3p0.min_size">10</prop>
<prop key="hibernate.c3p0.max_size">50 </prop>
<prop key="hibernate.c3p0.idle_test_period">300</prop>
<prop key="hibernate.c3p0.timeout">0</prop>
<prop key="hibernate.c3p0.max_statements">15</prop>
<prop key="hibernate.c3p0.acquire_increment">3</prop>
</props>
</property>
The spring datasource config is :-
Code:
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${jdbc.driverClassName}"/>
<property name="jdbcUrl" value="${jdbc.url}"/>
<property name="user" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<property name="acquireRetryAttempts" value="3"/>
<property name="maxStatementsPerConnection" value="5"/>
<!-- <property name="maxStatements" value="15"/> -->
</bean>
With
maxStatements commented in datasource, I expect the hibernateProperties
hibernate.c3p0.max_statements to be active. However the following log shows the Hibernate default value for max statements which is 0
2007-05-08 13:53:47,212 INFO [com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource] - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 3, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 17g3ycg7mtmnwdimi191y|1284fd4, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> oracle.jdbc.driver.OracleDriver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 17g3ycg7mtmnwdimi191y|1284fd4, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:oracle:thin:@localhost:1521:xxxx, lastAcquisitionFailureDefaultUser -> null, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15,
maxStatements -> 0, maxStatementsPerConnection -> 5, minPoolSize -> 3, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
When
maxStatements in datasource configuration is uncommented, the max statements are configured correctly to 15 as defined in the datasource.
From what i understand, some of the c3p0 properties must be explicitly mentioned in the hibernate config, to prevent from using hibernate defaults over the actual c3p0 properties. In this case, why is Hibernate not able to set
hibernate.c3p0.max_statements? I am using Hibernate 3. Am I missing something?
Thanks,
Nik