4 Replies Latest reply on Jul 14, 2004 6:01 AM by Alexey Loubyansky

    jbosscmp-jdbc.xml relationship mapping dbindex problems

    garek Newbie


      I'm using jboss 3.2.5 with mysql 4.0.18. However, I'm having problems when I try to have Jboss create indexes on foreign keys when it creates tables.

      For example, I have two entity beans, ItemEJB and ItemQuantitiesEJB, in a one-to-many relationship. ItemEJB has a primary key field called itemId and ItemQuantitiesEJB has a foreign key column called ItemEJB_foreignKey, which corresponds to the itemId field in ItemEJB.

      When I deploy the application, the tables are created, and then Jboss creates an index on the ItemEJB_foreignKey field in the ItemQuantitiesEJB table, which is what I want.

      But here is the problem, Jboss then tries to create an index on a field called ItemEJB_foreignKey in the ItemEJB table - but this field does not exist, causing an sql exception to be thrown.

      Here's the relationship mapping from the jbosscmp-jdbc.xml file:

       <foreign-key-mapping />
       <dbindex />
       <batch-cascade-delete />
      Is there something I'm missing?