将Glassfish v2升级到JPA 2.0? [英] Upgrade Glassfish v2 to JPA 2.0?

查看:199
本文介绍了将Glassfish v2升级到JPA 2.0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Glassfish V2上使用Hibernate 3.5.5和Spring HibernateJpaVendorAdapter,但在初始化Spring上下文时出现以下异常:

  java.lang.NoSuchMethodError:javax.persistence.spi.PersistenceUnitInfo.getSharedCacheMode()Ljavax / persistence / SharedCacheMode; 

at org.hibernate.ejb.util.LogHelper.logPersistenceUnitInfo(LogHelper.java:39)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:517)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)



问题是Glassfish V2使用JPA1.0,它在Hibernate附带的hibernate-jpa-2.0-api-1.0.0.Final.jar之前加载到服务器类路径中。 JPA 1.0在PersistenceUnitInfo中没有getSharedCacheModel方法,但是JPA 2.0没有。



是否有任何方法可以将Glassfish V2升级为使用JPA 2.0(或其他解决方案)?



干杯,

J

解决方案

JPA 2.0 jar包含在 / domain / lib / endorsed中 dir


I'm trying to use Hibernate 3.5.5 with Spring HibernateJpaVendorAdapter on Glassfish V2 but I'm getting the following exception when the Spring context is initialised:

java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getSharedCacheMode()Ljavax/persistence/SharedCacheMode;

at org.hibernate.ejb.util.LogHelper.logPersistenceUnitInfo(LogHelper.java:39) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:517) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)

The problem is that Glassfish V2 uses JPA1.0 which is loaded on the server classpath before hibernate-jpa-2.0-api-1.0.0.Final.jar which ships with Hibernate. JPA 1.0 doesn't have a getSharedCacheModel method in PersistenceUnitInfo but JPA 2.0 does.

Is there any way of upgrading Glassfish V2 to use JPA 2.0 (or any other solution to this problem)?

Cheers,

J

解决方案

You can try putting the JPA 2.0 jar in the /domain/lib/endorsed dir

这篇关于将Glassfish v2升级到JPA 2.0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆