[hibernate-issues] [Hibernate-JIRA] Created: (ANN-694) Circularity check error caused by naming conflicts of tables or/and keys

M. Lhotellerie (JIRA) noreply at atlassian.com
Wed Feb 6 14:32:55 EST 2008


Circularity check error caused by naming conflicts of tables or/and keys
------------------------------------------------------------------------

                 Key: ANN-694
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-694
             Project: Hibernate Annotations
          Issue Type: Bug
    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
         Attachments: CircularityTest.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: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list