JR Galia
JR Galia

Reputation: 17269

Google App Engine - Update JPA 1 to JPA 2

I want to update my GAE web app to use JPA 2.0. From the doc here, it says that I have to copy the content of appengine-java-sdk/lib/opt/user/datanucleus/v2/ to lib folder of the project.

This are the files of appengine-java-sdk/lib/opt/user/datanucleus/v2/:

  1. asm-4.0.jar
  2. datanucleus-api-jdo-3.1.3.jar
  3. datanucleus-api-jpa-3.1.3.jar
  4. datanucleus-appengine-2.1.2.jar
  5. datanucleus-core-3.1.3.jar
  6. geronimo-jpa_2.0_spec-1.0.jar
  7. jdo-api-3.0.1.jar
  8. jta-1.1.jar

Currently, this are the content of project's lib folder that might affect the migration:

  1. appengine-api-1.0-sdk-1.7.7.1.jar
  2. appengine-api-labs.jar
  3. appengine-endpoints.jar
  4. appengine-jsr107cache-1.7.7.1.jar
  5. asm-3.3.jar
  6. asm-commons-3.3.jar
  7. asm-tree-3.3.jar
  8. datanucleus-appengine-1.0.10.final.jar
  9. datanucleus-core-1.1.5.jar
  10. datanucleus-jpa-1.1.5.jar
  11. geronimo-jpa_3.0_spec-1.1.1.jar
  12. geronimo-jta_1.1_spec-1.1.1.jar
  13. jdo2-api-2.3-eb.jar
  14. jsr107cache-1.1.jar

Which files should I delete? I tried to delete files which have new version but eclipse is looking for older files:

  1. datanucleus-appengine-1.0.10.final.jar
  2. datanucleus-core-1.1.5.jar
  3. geronimo-jpa_3.0_spec-1.1.1.jar

This is 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"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
        http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">

    <persistence-unit name="transactions-optional">
        <provider>org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider</provider>
        <properties>
            <property name="datanucleus.NontransactionalRead" value="true"/>
            <property name="datanucleus.NontransactionalWrite" value="true"/>
            <property name="datanucleus.ConnectionURL" value="appengine"/>

            <property name="datanucleus.appengine.ignorableMetaDataBehavior" value="NONE"/>
        </properties>
    </persistence-unit>

</persistence>

Any help on this? Thanks

Upvotes: 2

Views: 1149

Answers (1)

Youans
Youans

Reputation: 5081

using Datanucleus requires eclipse plugin check this link

Change Persistence Provider to in your persistence.xml org.datanucleus.api.jpa.PersistenceProviderImpl JPA 2.0 Provider more here

Change every single library with the same new one

here is a screen shot of my application Note* Using GAE 1.7.4

GAE-lib here

Upvotes: 1

Related Questions