1 Reply Latest reply on Dec 5, 2001 4:52 PM by Dain Sundstrom

    Deploying Entity Bean

    David Hickman Newbie

      I have a bean for an Individual:

      public IndividualPK ejbCreate( String forename,
      String surname,
      String department,
      String administrator,
      String controller)
      throws CreateException
      this.forename = forename;
      this.middlename = "";
      this.surname = surname;
      this.department = department;
      this.administrator = administrator;
      this.budgetController = controller;
      username = forename.substring(0,1) +
      passwd = username;
      userCurrent = "Y";
      return null;

      with a primary key class defined as:

      public class IndividualPK implements Serializable
      public String username;
      public IndividualPK(String key)
      this.username = key;
      public IndividualPK()
      public String toString()
      return username.toString();
      public boolean equals(Object ind )
      return ((IndividualPK)ind).username.equals(username);

      and an ejb-jar:

      Models an Individual

      However when I try to deploy this to the container I get an error message:
      The return type of ejbCreate must be the entity beans primary key type, ANY IDEAS?

        • 1. Re: Deploying Entity Bean
          Dain Sundstrom Master

          This line is wrong:


          It still won't work because your pk is missing a hashCode method. You must be very very very careful with the implementation of your pk class, or you will get weird error that are almost impossible to debug.

          I would recommend that you use a simple pk, like java.lang.String.