Java – using connection pooling in JPA

I have a standalone JPA (hibernate) - MySQL application

My persistence XML looks like:

<persistence-unit name="JPAProj" transaction-type="RESOURCE_LOCAL">
            <!-- Persistence provider -->
            <provider>
                org.hibernate.ejb.HibernatePersistence
            </provider>
          ....
          <properties>
                    <property name='hibernate.show_sql' value='true'/>
                    <property name='hibernate.format_sql' value='true'/>
                    <property name='hibernate.dialect' value='org.hibernate.dialect.MysqL5InnoDBDialect'/>
                    <property name='hibernate.hbm2ddl.auto' value='update'/>

                    <property name="javax.persistence.jdbc.driver" value="com.MysqL.jdbc.Driver"/>
                    <property name="javax.persistence.jdbc.url" value="jdbc:MysqL://localhost/classicmodels"/>
                    <property name="javax.persistence.jdbc.user" value="someuser"/>
                    <property name="javax.persistence.jdbc.password" value=""/>
           </properties>
     </persistence-unit>

I want to use connection pooling in this application (such as Apache DBCP), and I need to check persistence What changes have you made to XML?

Solution

You can use c3p0 connection pool to sleep Check the c3p0 configuration of this web address

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>