java – 在JPA中使用连接池
发布时间:2020-05-24 01:25:37 所属栏目:Java 来源:互联网
导读:我有一个独立的JPA(Hibernate) – MySQL应用程序. 我的persistence.xml看起来像: persistence-unit name=JPAProj transaction-type=RESOURCE_LOCAL !-- Persistence provider -- provider
|
我有一个独立的JPA(Hibernate) – MySQL应用程序. 我的persistence.xml看起来像: <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>
我想在此应用程序中使用连接池(比如Apache DBCP),我需要对persistence.xml进行哪些更改? 解决方法您可以使用c3p0连接池进行休眠.检查此网址 C3P0 configuration(编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
