Search code examples
javahibernatejpaconnection-poolingc3p0

hibernate, jpa, c3p0, and warning HHH000208


I'm using Hibernate 4.1.6Final for accessing a JPA data source. While adding connection pooling via c3p0 I ran into this log message:

611  [main] WARN  org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator  - HHH000208: org.hibernate.connection.C3P0ConnectionProvider has been deprecated in favor of org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider; that provider will be used instead.

Here are the hibernate artifacts from my POM:

<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-entitymanager</artifactId>
  <version>4.1.6.Final</version>
</dependency>
<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-c3p0</artifactId>
  <version>4.1.6.Final</version>
</dependency>

and the relevant properties from persistence.xml:

<property name="hibernate.connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider" />
<property name="hibernate.c3p0.max_size" value="100" />
<property name="hibernate.c3p0.min_size" value="5" />
<property name="hibernate.c3p0.acquire_increment" value="5" />
<property name="hibernate.c3p0.idle_test_period" value="500" />
<property name="hibernate.c3p0.max_statements" value="50" />
<property name="hibernate.c3p0.timeout" value="10000" />

I get the same warning even if I change the name of the provider to the favored class. What's the correct class name to use for hibernate.connection.provider_class? Is there a preferred connection provider for production use that's not c3p0?


Solution

  • I was observing the same warning for a while now and did not seen any impact on the functionality or performance of my app. But today I decided to switch the entry (as stated in the warning msg itself) in my persistence.xml to:

    <!-- C3p0 connection pooling configuration -->
    <property name="hibernate.connection.provider_class" value="org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider"/>
    

    This solved the issue; I am also using 4.1.6Final.