日期:2014-05-20  浏览次数:20899 次

Hibernate3.6final出现javax.persistence.OneToMany.orphanRemoval()Z异常
我现在用的是hibernate3.6final,出现了下面这个异常:(当我使用@ManyToOne时,不会出现异常,而且用@ManyToMany也正常[size=14px][/size])

java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1912)
at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:796)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:707)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3977)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3931)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1368)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1826)
at test.com.bean.TestAnnotationPersonEmail.testPersonEmail(TestAnnotationPersonEmail.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

我在网上找了很多答案,无论我怎么按照他们说的去做,都没有,我现在在这里请求大家帮帮忙,以前有没有人遇到过类似的问题,有的话,最好了,告诉我怎么做?????应该不是代码的问题,我在这里就不贴自己的代码了。不知道为什么当使用多对一,多对多,就能正常运行。

------解决方案--------------------

------解决方案--------------------
可能是jar包版本没有对应起来,你查查Hibernate3.6final需要什么支撑jar包
------解决方案--------------------
兄弟,去掉了那个ejb3-persistence.jar,把它干掉,就他娘的好事了!呵呵
可能是和其他的jar包有冲突,你用的是不是 Hibernate3.5.0?? 不管用什么,要不就升级到,要不就去掉就差不多了…………呵呵
看到了,和你说一声…………在这个网址看到的,要是好使就给踩踩,毕竟是别人的力量,呵呵


http://haojie-java-ms.javaeye.com/blog/666618
------解决方案--------------------
dui
探讨

可能是jar包版本没有对应起来,你查查Hibernate3.6final需要什么支撑jar包