0

I am setting up a minimal working example where I use EclipseLink in a Java EE (JSF) project. My example works perfectly with the following configuration and code:

persistence.xml

<persistence
    version="2.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_2_0.xsd"
>
    <persistence-unit name="issat_PU_Local" transaction-type="RESOURCE_LOCAL">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <class>pro.entity.Utilisateur</class>
        <properties>
            <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
            <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/issat" />
            <property name="javax.persistence.jdbc.user" value="java" />
            <property name="javax.persistence.jdbc.password" value="JaVa" />
            <property name="eclipselink.logging.level.sql" value="FINE" />
            <property name="eclipselink.logging.parameters" value="true"/>
        </properties>
    </persistence-unit>
</persistence>

Since I don't want to use JTA I am using RESOURCE_LOCAL as transaction type and perfectly leaving with "manually" handling transaction inside my DAO.

I now want to use BoneCP connection pool with my example. How should I precisely modify my persistence.xml to do that? I found many configuration examples in the internet using also Hibernate, but I want to stay with EclipseLink.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
anismek
  • 29
  • 7

1 Answers1

0

I couldn't do it with bonecp, but I could get a pool connection with C3PO. I followed this link : http://javabeginnerstutorial.com/hibernate/connection-pooling-with-hibernate-4/

I copied the dependency and the properties but, instead of <property name="hibernate.c3p0.min_size">1</property> put the value in the tag like this<property name="hibernate.c3p0.min_size" value="1"/>, otherwise I got an error.

Finally mi persitence.xml look this way: enter image description here

Ajay
  • 18,086
  • 12
  • 59
  • 105