1 Reply Latest reply on Nov 21, 2002 8:21 AM by alexb

    key-field problem of Relationships in jbosscmp-jdbc.xml

    ericmacau

      Hello,

      If the primary-key of the Entity is a Class(MyPK.class), how to use it in relationships definition?

      As following,

      <ejb-relation>
      <ejb-relation-name>Restaurant-Menu</ejb-relation-name>
      <foreign-key-mapping/>

      <ejb-relationship-role>
      <ejb-relationship-role-name>restaurant-has-menu</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>id</field-name>
      <column-name>menuID</column-name>
      </key-field>
      </key-fields>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>menu-belongs-to-restaurants</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>id</field-name>
      <column-name>restaurantID</column-name>
      </key-field>
      </ejb-relationship-role>
      </ejb-relation>




      Both the primary-key of Restaurant and Menu are defined as primary class(RestaurantPK.class, MenuPK.class).

      So, how to define the <key-fields> ?????

      Best regards,
      Eric

        • 1. Re: key-field problem of Relationships in jbosscmp-jdbc.xml
          alexb

          Eric,

          I was hoping somebody would answer your questions because I'm having the same problem.... I've look around the forum and have not got my question answered yet. I have a one to many relationship lets same an entity bean named bidHeader and an entity bean named bidItem...

          BidHeader has many bidItems and both have a primary key class just like your question and I was also wondering about the relationships in the jbossjdbc.xml file and one other thing is that the same code I have running in weblogic with no problems so I think its a jboss thing...
          Just wanted to let you know that your not the only one with this problem...

          Alex