0 Replies Latest reply on Nov 18, 2002 11:05 PM by Eric Chow

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

    Eric Chow Apprentice

      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