I'm using Hibernate 3.3.2 with spring 2.5.6. I've configured a c3p0 datasource in my spring config file along with a hibernate sessionFactory. I'm expecting a C3P0ConnectionProvider to be used but for some reason Hibernate seems to stick with using a LocalDataSourceConnectionProvider. I can see this in the logs when the app is starting...
Code:
INFO - ConnectionProviderFactory - Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
My app appears to be working fine in so far as it's using c3p0 connections. I know this because I've turned on c3p0 logging and I can see entries like this (now that I see it, why is this coming from BasicResourcePool rather than ComboPooledDataSource)...
Code:
DEBUG - BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@1991de1 [managed: 3, unused: 2, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1a3e41f)
Would anyone know why LocalDataSourceConnectionProvider is being used instead of C3P0ConnectionProvider?
Here's my spring config...
Code:
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="org.hsqldb.jdbcDriver"/>
<property name="jdbcUrl" value="jdbc:hsqldb:hsql://localhost:9001"/>
<property name="user" value="sa"/>
<property name="password" value=""/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="annotatedClasses">
<list>...</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
<prop key="hibernate.hbm2ddl.auto">create</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</prop>
<prop key="hibernate.c3p0.acquire_increment">1</prop>
<prop key="hibernate.c3p0.idle_test_period">100</prop>
<prop key="hibernate.c3p0.timeout">100</prop>
<prop key="hibernate.c3p0.max_size">5</prop>
<prop key="hibernate.c3p0.max_statements">0</prop>
<prop key="hibernate.c3p0.min_size">1</prop>
</props>
</property>
</bean>
btw, the c3p0 config settings don't work where they are now. c3p0 is just falling back to the defaults for all these settings. If I move them into the dataSource config (and translate back the real parameter names) they work fine. No doubt this is a related problem.