1 Reply Latest reply on Nov 30, 2001 3:28 AM by Fred Loney

    proble with composite pk in ejbCreate

    francesco milesi Newbie

      I have a table named AUTHOR_CATHEGORY with two columns that are FK on table AUTHOR and CATHEGORY respectively, wich both have a PK of type Long.
      I have created a bean for this table, that has the following descriptor:


      where relation is the name of the only field in the bean that is also the primary key of type authors.AuthorCathegoryPK and authors.AuthorCathegoryPK is defined as follows:

      public class AuthorCathegoryPK implements Serializable {

      public Long fkAuthor;
      public Long fkCathegory;

      public AuthorCathegoryPK() {

      public AutoriCatautoriPK(Long fkAuthor, Long fkCathegory) {
      this.fkAuthor= fkAuthor;
      this.fkCathegory= fkCathegory;
      public boolean equals(Object obj) {
      if (this.getClass().equals(obj.getClass())) {
      AuthorCathegoryPK that = (AuthorCathegoryPK) obj;
      return this.fkAuthor.equals(that.fkAuthor) && this.fkCathegory.equals(that.fkCathegory);
      return false;
      public int hashCode() {
      return ("" +fkAuthor+ fkCathegory).hashCode();

      Finally in the jaws file I mapped fields and columns as follows:


      When I call a create on this bean I get an error from the jdbc driver saying:

      "Name of column 'relation' is not valid"

      What's wrong with my mapping ?

      Thanks in advance

        • 1. Re: proble with composite pk in ejbCreate
          Fred Loney Newbie

          The components of a composite pk must be individual cmp-fields. Omit primkey-field: