2 Replies Latest reply on Dec 5, 2001 4:42 PM by lafr

    "foreign key" contraints, order of table generation

    lafr

      I am using the current CVS-version of jboss 3.0.
      Since a few days, a foreign key constraint can be generated when deploying entity-beans with cmp2.0.
      I have AddressEJB which has a many2one-uni-Relationship to CountryEJB and I have ItemEJB which has many2one-uni-Relationships to ItemGroupEJB and UnitOfMeasureEJB.
      The foreign key constraint for Table Address is generated. The constraints for Item-ItemGroup and Item-UnitOfMeasure are not generated.
      I think it has to do with the order in which the Beans are deployed. All Beans are in one jar.
      The order is Item, UnitOfMeasure, Country, ItemGroup, Address.
      So when Item is created, the related Tables are not there, so no foreign key can be created.
      When creating Table Address, the related table country does exist and the foreign key can be created.

      If this is the reason, how can I influence the order of deploying the beans inside the jar ?

        • 1. Re: "foreign key" contraints, order of table generation
          dsundstrom

          The foriegn key generation is not dependent on the order of the beans being deployed. The system waits until both beans are deployed and then alters the table.

          JBossCMP will only alter the table if the fk-constraint is true and if it actually creates the table. It will not alter a table that is already created.

          If that doesn't help try adding some print statements to the code (JDBCStartCommand.java)

          • 2. Re: foreign keys
            lafr

            I found the bugs in JDBCStartCommand and applied a patch to sourceforge.