【发布时间】:2017-07-31 09:09:00
【问题描述】:
我无法在 RAD7 中将 JPA 版本从 1.0 更改为 2.0,这给我带来了一个问题:
NoSuchMethodError: javax/persistence/spi/PersistenceUnitInfo.getSharedCacheMode()Ljavax/persistence/SharedCacheMode;
当我去项目方面时,它被固定在 1.0 并且我无法更改它,任何帮助将不胜感激。
注意:如果我无法更改它,我很高兴知道未知方法是什么,因此我可以根据它的重要性将其删除,谢谢。
编辑: 当我像这样更改 presistence.xml 标头中的版本时:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" 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://xmlns.jcp.org/xml/ns/persistence/persistence_2_0.xsd ">
<persistence-unit name="ReportManager" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
我得到这个错误:
cvc-complex-type.3.1:元素的属性“版本”的值“2.0” “实体映射”相对于相应的无效 属性使用。属性“版本”的固定值为“1.0”
【问题讨论】:
-
请显示完整的堆栈跟踪。