openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Web developer <webautomat...@gmail.com>
Subject Re: persistence.xml properties defined
Date Mon, 17 May 2010 15:20:13 GMT
Here what I use:

EntityManagerFactory emf =
Persistence.createEntityManagerFactory("embeddables",
System.getProperties());
        EntityManager em = emf.createEntityManager();
        init(em);
        runQueries(em);

runner arguments:

-DConnectionDriverName=org.hsqldb.jdbc.JDBCDriver
-DConnectionURL=jdbc:hsqldb:file:/tmp/persist_bacend
-DDynamicEnhancementAgent=false -DRuntimeUnenhancedClasses=unsupported

My persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="1.0">

    <persistence-unit name="hellojpa" transaction-type="RESOURCE_LOCAL">
        <!--
            The default provider can be OpenJPA, or some other product.
            This element is optional if OpenJPA is the only JPA provider
            in the current classloading environment, but can be specified
            in cases where there are multiple JPA implementations available.
        -->
        <!--
        <provider>
            org.apache.openjpa.persistence.PersistenceProviderImpl
        </provider>
        -->

        <!-- We must enumerate each entity in the persistence unit -->
        <class>hellojpa.Message</class>

        <properties>
            <!--
                We can configure the default OpenJPA properties here. They
                happen to be commented out here since the provided examples
                all specify the values via System properties.

            <property name="openjpa.DynamicEnhancementAgent" value="false"/>

            <property name="openjpa.RuntimeUnenhancedClasses"
value="unsupported"/>
            -->

            <property name="openjpa.Sequence"
value="org.apache.openjpa.jdbc.kernel.ClassTableJDBCSeq"/>
        </properties>
    </persistence-unit>

    <persistence-unit name="embeddables" transaction-type="RESOURCE_LOCAL">

<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
        <class>Address</class>
        <class>ContactInfo</class>
        <class>Phone</class>
        <class>User</class>
    </persistence-unit>
</persistence>

John

2010/5/17 Jeremy Bauer <techhusky@gmail.com>

> John,
>
> Do you specify the persistence unit name when you create the entity manager
> factory?  If not, you may be picking up the default persistence unit which
> likely has those properties defined.  If you do specify the PU name could
> you post your persistence.xml and the version of OpenJPA you are using?
>
> -Jeremy
>
> On Sat, May 15, 2010 at 2:35 AM, Web developer <webautomator2@gmail.com
> >wrote:
>
> > Hi. My persistence.xml contained ConnectionDriverName and ConnectionURL
> > properties defined for the unit that was not in use. But even when I
> added
> > tags into config for another unit - the effect is the same. John
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message