1 Reply Latest reply on Mar 13, 2002 2:11 PM by Dain Sundstrom

    object identity for entities with compound primary keys

    Mac Rinehart Newbie

      Duan,

      I recently noticed in objects with compound primary keys only one key field is used to identify the entity bean reference in the container. For example:

      // given I have an accountBeanRef to an entity with an pk(id = 145, createDate = 1016009775867)

      System.out.println(accountBeanRef);
      // result: atm/ejb/accountEJB:145

      I presume that is is the result of the accountBeanRef.toString() as well. I think a more elegant solution would be to concat all the values of all the fields together, such as:

      System.out.println(accountBeanRef);
      // result atm/ejb/accountEJB:145_1016009775867

      Food for thought.

      - Mac