I get the following exception while creating EntityManagerFactory. This looks like a incompatibility between annotations and hibernate libs.
I use:
Hibernate Core 3.2.CR2
Hibernate Annotations 3.1.0 beta 10
Hibernate EntityManager 3.1.0 beta 8
java.lang.NoSuchMethodError: org.hibernate.cfg.NamingStrategy.foreignKeyColumnName(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
at org.hibernate.cfg.Ejb3JoinColumn.linkValueUsingDefaultColumnNaming(Ejb3JoinColumn.java:266)
at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:198)
at org.hibernate.cfg.FkSecondPass.doSecondPass(FkSecondPass.java:45)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:261)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1034)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:868)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:163)
at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:641)
at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:134)
at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:188)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:114)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27)
at com.siemens.smarthome.AquireEntityManager.setUp(AquireEntityManager.java:13)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
The code disassabled from annotations jar.
Code:
if(ownerSide)
/* 266*/ columnName = getMappings().getNamingStrategy().foreignKeyColumnName(getPropertyName(), getMappings().getLogicalTableName(referencedTable), logicalReferencedColumn);
foreignKeyColumnName takes 4 parameters. I chacked that in version 3.1 it takes 3 parameters.
I tried to run the application with hibernate core 3.1 but there were other errors.
I don't understand. This error should break compilation!
Please give me some advice how to workaround this.
PS. I used the same persistence unit with jboss 4.0.4CR2. I will try to use libs shiped with jboss.