I may be missing something obvious, but I cannot get OpenJPA to hold
onto a database connection. This is with 1.0.2 and 1.1.0 in a
standalone unenhanced Swing client, no connection pooling.
I've watched MySQL Administrator and netstat, but all I see is the
connection being thrown away after I finish a transaction and close
the EntityManager.
Here's my persistence-unit:
<?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="default" transaction-type="RESOURCE_LOCAL">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<class>com.xxxxxx.models.User</class>
<properties>
<property name="openjpa.Log" value="DefaultLevel=WARN" />
<property name="openjpa.ConnectionRetainMode" value="always" />
<property name="openjpa.ConnectionDriverName"
value="com.mysql.jdbc.Driver" />
<property name="openjpa.ConnectionUserName" value="xxxxxx" />
<property name="openjpa.ConnectionPassword" value="xxxxxx" />
<property name="openjpa.ConnectionURL"
value="jdbc:mysql://localhost/xxxxxx" />
</properties>
</persistence-unit>
</persistence>
Thanks,
David
|