2017-07-31 76 views
0

我无法从1.0 RAD7改变JPA版本2.0,而且它造成了我一个问题,就是:为什么我无法将项目构面中的JPA版本更改为RAD7中的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: Value ‘2.0’ of attribute ‘version’ of element ‘entity-mappings’ is not valid with respect to the corresponding attribute use. Attribute ‘version’ has a fixed value of ‘1.0’

+0

请显示完整的堆栈追踪。 –

回答

0

你也应该从1升级javax.persistence .x转换为2.x,例如,javax.persistence-2.1.0.jar。

的pom.xml

<dependency> 
    <groupId>org.eclipse.persistence</groupId> 
    <artifactId>javax.persistence</artifactId> 
    <version>2.1.0</version> 
</dependency> 

相关问题