Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrading from JPA 2.1 to JPA 2.2

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?

like image 437
Leon Dendle Avatar asked Oct 06 '17 08:10

Leon Dendle


People also ask

What is the latest JPA version?

Jakarta Persistence 3.1 Version 3.1 was released in 2022.

What is JPA 2. 1?

jpa-2.1. Java Persistence API (JPA) 2.1 for WebSphere Application Server is built on the EclipseLink open source project. EclipseLink is the reference implementation for all versions of the JPA specification. The provider of JPA for this product is org. eclipse.

What is new in JPA 3. 0?

JPA 3.0 brings no new features. It only changes the prefix of all API classes' package names, the prefix of some configuration properties, and the schema namespaces for all XML-based configuration files. The goal of these changes was to replace the word “java” to avoid legal issues.


1 Answers

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.

like image 110
hd42 Avatar answered Sep 27 '22 20:09

hd42