Update from JPA 2.1 to JPA 2.2

I'm having problems upgrading to JPA 2.2. I use 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 persistence.xml to point to the correct xsd version:

<?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 problem is that I get the following error message:

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

I looked at the eclipelink documentation and don't jump anything at me.

Any ideas?

+4
source share

Source: https://habr.com/ru/post/1687009/


All Articles