]
Jeff Glass updated ANN-694:
---------------------------
Attachment: CircularityTest2.zip
The problem still exists, it just takes a more complex example to show it. In my example,
the inheritance hierarchy is Agent -> UnderwritingUser -> User -> Person ->
AddressableNamedEntity. This results in an erroneous "circular dependency"
error.
/jeff
Incorrect report of FK circularity error when the @*ToOne property
name starts with the identifier property name
----------------------------------------------------------------------------------------------------------------
Key: ANN-694
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-694
Project: Hibernate Annotations
Issue Type: Bug
Components: binder
Affects Versions: 3.3.1.beta1
Environment: core 3.2, annotations 3.3.0.GA, entitymanager 3.3.1.GA
AS400/DB2
Reporter: M. Lhotellerie
Fix For: 3.3.1.GA
Attachments: CircularityTest.zip, CircularityTest2.zip
As discussed here
http://forum.hibernate.org/viewtopic.php?t=983543, a circularity check
error probably caused by naming conflicts (Tables or/and keys).
These examples work for tables "Acces", "Droitacces" or
"Benefserv"
- rename forgein key "idpkdracc" to something which doesn't begin by
"idpk"
- rename primary key "idpk" to something different of "i",
"id", "idp" and "idpk"
Also you can rename "Droitacces" to "B", but renaming others
class/tables don't seem don't work
@Entity
public class Acces {
@Id
private BigInteger idpk;
@ManyToOne
private Droitacces idpkdracc;
}
//------------------------------------------------------------------
@Entity
public class Droitacces {
@Id
private BigInteger idpk;
@ManyToOne
private Benefserv idpkbenef;
}
//------------------------------------------------------------------
@Entity
public class Benefserv {
@Id
private BigInteger idpk;
@ManyToOne
private Service idpkser;
}
//------------------------------------------------------------------
@Entity
public class Service {
@Id
private BigInteger idpk;
}
//------------------------------------------------------------------
javax.persistence.PersistenceException: org.hibernate.AnnotationException: Foreign key
circularity dependency involving the following tables: Droitacces, Benefserv, Acces
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:258)
at
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
at test.DoTest.initTest(DoTest.java:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
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: org.hibernate.AnnotationException: Foreign key circularity dependency
involving the following tables: Droitacces, Benefserv, Acces
at
org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:458)
at
org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:295)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1269)
at
org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:150)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:888)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:186)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:246)
... 24 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: