2015-04-03 49 views
1

我正在使用JPA爲我的項目的持久性,並沒有真正瞭解任何有關休眠,但大多數教程我發現設置連接池使用c3p0和休眠。驗證與JPA運行的c3p0

我的繼承人persistence.xml文件

<?xml version="1.0" encoding="UTF-8"?> 
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> 
    <persistence-unit name="Cinemango308PU" transaction-type="RESOURCE_LOCAL"> 
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> 
    <class>JPA.Ad</class> 
    <class>JPA.Photo</class> 
    <class>JPA.Theatre</class> 
    <class>JPA.Creditcard</class> 
    <class>JPA.Moviereview</class> 
    <class>JPA.Giftcard</class> 
    <class>JPA.Showtime</class> 
    <class>JPA.Ticket</class> 
    <class>JPA.Favoritetheatres</class> 
    <class>JPA.User</class> 
    <class>JPA.Actor</class> 
    <class>JPA.Movie</class> 
    <class>JPA.Theatrerewards</class> 
    <class>JPA.Payment</class> 
    <exclude-unlisted-classes>false</exclude-unlisted-classes> 
    <properties> 
     <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:5432/cinemango> 
     <property name="javax.persistence.jdbc.user" value="xxxx"/> 
     <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/> 
     <property name="javax.persistence.jdbc.password" value="xxxxxx"/> 
     <property name="javax.persistence.schema-generation.database.action" value="create"/> 

     <!-- Configuring Connection Pool --> 
     <property name="connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider" /> 

      <property name="hibernate.c3p0.max_size" value="5" /> 
      <property name="hibernate.c3p0.min_size" value="0" /> 
      <property name="hibernate.c3p0.acquire_increment" value="1" /> 
      <property name="hibernate.c3p0.idle_test_period" value="300" /> 
      <property name="hibernate.c3p0.max_statements" value="0" /> 
      <property name="hibernate.c3p0.timeout" value="100" /> 
    </properties> 
    </persistence-unit> 
</persistence> 

如何測試,如果連接池的工作?我沒有看到顯示我的輸出日誌

回答