0 Replies Latest reply on Sep 11, 2005 5:18 PM by George Berish

    How to map C-M-Relationship Field to Table Column?

    George Berish Novice


      Please help!

      My Database has two tables:

      - PK (primary key column)
      - MEMBERS_PK (stores foreign key to "members" - Integer)

      "members" table with a 1:1 bi-directinal relationship.
      - PK (primary key column)
      - NAMES_PK (stores foreign key to "names" - Integer)

      I can make my Names Entity Bean work with the accessor fields, ejb-jar.xml and jbosscmp-jdbc.xml snipits shown below.

      Note I can map the "pk" ben field implied by get/set Pk () to the all caps "PK" table column.

      But I cannot find a way to map a differnt bean field namefor the relationship field associated with the MEMBERS_PK column.

      I had to use get/setMEMBERS_PK () to make it work.

      Can anyone tell me what I am missing?

      I'd really like to:
      - use get/SetMembersPk () in my bean and
      - then map "membersPk" to the "MEMBERS_PK" table column.

      using the <cmp-field> tag in jbosscmp-jdbc.xml file just gave me eroros or a giant bit blob being stored.

       // abstract relationship fields
       public abstract MemberLocal getMEMBERS_PK ();
       public abstract void setMEMBERS_PK (MemberLocal local);
       // abstract persistence fields
       public abstract Integer getPk ();
       public abstract void setId (Integer newId);
      Please help.