Hibernate3.5.5中 java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanR

java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z

的解决方式

Caused by: java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1830)
at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:762)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:726)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:636)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:359)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1206)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:673)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
... 71 more

 

查了很多资料,说什么的都有,但是自己解决办法是:

1,加入hibernate\lib\jpa中的jpa2.0的jar包

2。将JRE System Library的jdk设置成1.6以上版本

3,将ejb3-persistence去掉

注意:

hibernate-jpa-2.0-api-1.0.0.Final和ejb3-persistence有冲突,如果升级到Hibernate3.5那么可以把ejb3-persistence干掉

欢迎大家加入qq(107939385群)一起交流学习进步!

你可能感兴趣的:(java,Hibernate,orm,qq,jpa)