I want to use the c3p0 connection pool, but i just cannot configure hibernate to use it.
Please can somebody assist me? Pleeeease ...
Here is what i have done so far:
In my maven pom.xml i declared these dependencies:
Code:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.3.2.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.4.0.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>3.3.2.GA</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.12</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
In my persistence.xml i have this configuration:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="xxxPU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>xxxx</class>
<class>xxxx</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.connection.username" value="xxx"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.password" value="xxx"/>
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/xxx"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.format_sql" value="false"/>
<property name="connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider"/>
<property name="hibernate.c3p0.acquire_increment" value="1"/>
<property name="hibernate.c3p0.idle_test_period" value="60"/>
<property name="hibernate.c3p0.max_size" value="10"/>
<property name="hibernate.c3p0.max_statements" value="0"/>
<property name="hibernate.c3p0.min_size" value="2"/>
<property name="hibernate.c3p0.timeout" value="60"/>
<property name="hibernate.c3p0.validate" value="false"/>
</properties>
</persistence-unit>
</persistence>
And finally in my application i use the persistence unit like this:
Code:
emf = Persistence.createEntityManagerFactory("xxxPU");
But the hibernate log always tells me:
Quote:
[INFO] Started Jetty Server
INFO - Version - Hibernate Annotations 3.4.0.GA
INFO - Environment - Hibernate 3.3.2.GA
INFO - Environment - hibernate.properties not found
INFO - Environment - Bytecode provider name : javassist
INFO - Environment - using JDK 1.4 java.sql.Timestamp handling
INFO - Version - Hibernate Commons Annotations 3.1.0.GA
INFO - Version - Hibernate EntityManager 3.4.0.GA
...
INFO - rManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
I must be mistaken somewhere. Does anybody see the problem?