Upgrading from JPA 2.1 to JPA 2.2

Leon Dendle picture Leon Dendle · Oct 6, 2017 · Viewed 7.8k times · Source

I'm having issues upgrading to JPA 2.2. I'm using eclipselink and changed the version in my pom:

<dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>eclipselink</artifactId>
        <version>2.7.0</version>
</dependency>

I also updated the persistence.xml to point to the correct version of the xsd:

<?xml version="1.0" encoding="UTF-8" ?>
<persistence 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_2.xsd"
    version="2.2">
<persistence-unit name="foo" transaction-type="RESOURCE_LOCAL">
    <class>my.entity</class>
    <properties>
        <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
        <property name="javax.persistence.jdbc.url" value="jdbc:derby:foo/data;create=true" />
        <property name="javax.persistence.jdbc.user" value="user" />
        <property name="javax.persistence.jdbc.password" value="pwd" />

        <property name="eclipselink.ddl-generation" value="create-or-extend-tables" />
        <property name="eclipselink.ddl-generation.output-mode" value="database" />
    </properties>

</persistence-unit>
</persistence>

The issue is that I'm getting the following error message:

The persistence.xml file does not have supported content for this JPA platform.

I've looked through the eclipselink documentation and nothing is jumping out at me.

Any ideas?

Answer

hd42 picture hd42 · Apr 23, 2018

I ran into the same error message after upgrading from JPA 2.0 to 2.1; I got rid of it by also upgrading the JPA Platform in the Eclipse Project JPA settings to EclipseLink 2.5.x.