3 Replies Latest reply on May 18, 2004 10:53 AM by Juha Lindfors

    problems with ejb create and primary keys

    ghoyle Newbie


      I am having a problem deploying a sample entity I created. I am new to jboss and Entity Beans etc.
      I created a a simple Entity Bean based on CMP 2.0 and was hoping it would create the table when I deployed it.
      I am developing in Netbeans 3.6 and using the nbkboss pluging.

      The error i get from jboss is

      2004-05-13 16:14:54,541 INFO [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/opt/jboss-3.2.3/server/all/deploy/employ.jar
      2004-05-13 16:14:54,864 WARN [org.jboss.ejb.EJBDeployer.verifier] EJB spec violation:
      Bean : Employee
      Method : public EmployeePK ejbCreate(short, String, String, String, Date, String, String, short, String, BigDecimal, String) throws CreateException
      Section: 10.6.4
      Warning: The return type of an ejbCreate(...) method must be the entity bean's primary key type.

      2004-05-13 16:14:54,868 ERROR [org.jboss.deployment.MainDeployer] could not create deployment: file:/opt/jboss-3.2.3/server/all/deploy/employ.jar
      org.jboss.deployment.DeploymentException: Verification of Enterprise Beans failed, see above for error messages.

      The ejb create method I am using looks like

      public EmployeePK ejbCreate(short EmpNo , java.lang.String FirstName , java.lang.String LastName , java.lang.String PhoneExt , java.sql.Date HireDate , java.lang.String DeptNo , java.lang.String JobCode , short JobGrade , java.lang.String JobCountry , java.math.BigDecimal Salary , java.lang.String FullName) throws CreateException{
       setEmpNo(EmpNo) ;
       setFirstName(FirstName) ;
       setLastName(LastName) ;
       setPhoneExt(PhoneExt) ;
       setHireDate(HireDate) ;
       setDeptNo(DeptNo) ;
       setJobCode(JobCode) ;
       setJobGrade(JobGrade) ;
       setJobCountry(JobCountry) ;
       setSalary(Salary) ;
       setFullName(FullName) ;
       return null;

      The Primary key class is

      public class EmployeePK extends Object implements Serializable {
       public short EmpNo;
       public EmployeePK() {
       public EmployeePK(short EmpNo) {
       this.EmpNo = EmpNo ;
       * @see java.lang.Object#equals(Object)
       public boolean equals(Object otherOb) {
       boolean b = true;
       EmployeePK other = (EmployeePK) otherOb;
       if (this == otherOb) {
       return b;
       if (!(otherOb instanceof EmployeePK)) {
       return b;
       return b;
       *Override hashCode()

      Any help at all will be much appreciated.


        • 1. Re: problems with ejb create and primary keys
          Juha Lindfors Master

          How do you declare your PK in your deployment descriptor?

          • 2. Re: problems with ejb create and primary keys
            ghoyle Newbie

            my deployment descriptor or at least part of it is

             </entity> </enterprise-beans>

            Hope this helps...

            • 3. Re: problems with ejb create and primary keys
              Juha Lindfors Master

              Your prim-key-class must be something.something.EmployeePK