0 Replies Latest reply on Jan 11, 2006 6:33 AM by Thomas Lauerbach

    JBoss 4.0.2 tries to create fk-constraint twice

    Thomas Lauerbach Newbie

      I have a very strange behaviour. I have a simple one to many relationship. When setting fk-constraint to true in the default node of jbosscmp_jdbc.xml, CMP-Engine tries to create the fk-constraint twice. Oracle of course throws an SQLException (ORA-02275: such a referential constraint already exists in the table).

      From the server.log with debug logging on category org.jboss.ejb.plugins

      2006-01-11 12:18:28,898 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.ProjectContractor] Executing SQL: ALTER TABLE PROJECTCONTRACTOR ADD CONSTRAINT FK_PROJECTCONTRACTOR_PROJECT FOREIGN KEY (project) REFERENCES PROJECT (projectID)
      2006-01-11 12:18:28,913 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.ProjectContractor] Executing SQL: ALTER TABLE PROJECTCONTRACTOR ADD CONSTRAINT FK_PROJECTCONTRACTOR_PROJECT FOREIGN KEY (project) REFERENCES PROJECT (projectID)
      2006-01-11 12:18:28,913 WARN [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.ProjectContractor] Could not add foreign key constraint: table=PROJECTCONTRACTOR
      2006-01-11 12:18:28,913 ERROR [org.jboss.ejb.EntityContainer] Starting failed jboss.j2ee:jndiName=ResourceGroup,service=EJB
      org.jboss.deployment.DeploymentException: Error while adding foreign key constraint; - nested throwable: (java.sql.SQLException: ORA-02275: such a referential constraint already exists in the table
      )
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.addForeignKeyConstraint(JDBCStartCommand.java:1077)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.addForeignKeyConstraint(JDBCStartCommand.java:994)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.addForeignKeyConstraints(JDBCStartCommand.java:347)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:388)