我在升级到 JPA 2.2 时遇到问题。我正在使用 eclipselink 并更改了我的 pom 中的版本:
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.7.0</version>
</dependency>
我还更新了 persistence.xml 以指向正确版本的 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 persistence.xml file does not have supported content for this JPA platform.
我已经查看了 eclipselink 文档,但没有发现任何问题。
有什么想法吗?
最佳答案
从 JPA 2.0 升级到 2.1 后,我遇到了相同的错误消息;我还通过将 Eclipse 项目 JPA 设置中的 JPA 平台升级到 EclipseLink 2.5.x 来摆脱它。
关于java - 从 JPA 2.1 升级到 JPA 2.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46601528/