-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Hibernate Annotations has problem on @OneToOne
PostPosted: Tue May 25, 2010 11:23 pm 
Newbie

Joined: Tue May 25, 2010 11:15 pm
Posts: 2
Hibernate Annotations has problem on @OneToOne,the failure trace are:
java.lang.ExceptionInInitializerError
at test.rong.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:21)
at test.rong.hibernate.EntityTest.initSession(EntityTest.java:31)
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:585)
at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
at org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.NoSuchMethodError: javax.persistence.OneToOne.orphanRemoval()Z
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1567)
at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:769)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:733)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:636)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:359)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1377)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
at test.rong.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:17)
... 21 more

some body suggest delete the ejb3.jar,but i do it ,no correct


Top
 Profile  
 
 Post subject: Re: Hibernate Annotations has problem on @OneToOne
PostPosted: Wed May 26, 2010 5:45 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Quote:
some body suggest delete the ejb3.jar,but i do it ,no correct


Which version of hibernate do you use?

If you use hiberante 3.5 then in fact ejb3.jar must be removed from the classpath and must be substituted
by hibernate-jpa-2.0-api-1.0.0.Final.jar (you find it in the official distribution in folder /lib/jpa)


Top
 Profile  
 
 Post subject: Re: Hibernate Annotations has problem on @OneToOne
PostPosted: Wed May 26, 2010 11:00 pm 
Newbie

Joined: Tue May 25, 2010 11:15 pm
Posts: 2
Yes!,I removed the ejb3.jar,and add the hibernate-jpa-2.0-api-1.0.0.Final.jar,but it still can't work !
antlr-2.7.6.jar
commons-collections-3.1.jar
dom4j-1.6.1.jar
javassist-3.9.0.GA.jar
jta-1.1.jar
slf4j-api-1.5.8.jar
hibernate3.jar
hibernate-annotations.jar
mysql-connector-java-5.1.12-bin.jar
hibernate-commons-annotations.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar
slf4j-log4j12.jar
log4j.jar
Here is jars in my probject lib!


Top
 Profile  
 
 Post subject: Re: Hibernate Annotations has problem on @OneToOne
PostPosted: Thu May 27, 2010 6:14 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Hi dike,

please tell us which version of Hibernate do you intend to use!!


If you intend to use hibernate 3.5 then you must remove
hibernate-annotations.jar
and
hibernate-commons-annotations.jar
from your classpath,
as they definitely do not belong to a hibernate 3.5 distribution.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.