1 Reply Latest reply on Sep 19, 2002 2:43 PM by Dain Sundstrom

    Problem update data in CMP Entity Bean

    cfg123 Newbie

      Can anyone help me......
      When i want to update one record in this entity bean, this error occurred

      java.rmi.ServerException: null
      Embedded Exception
      A CMP field that is a member of the primary key can only be set in ejbCreate [EJB 2.0 Spec. 10.3.5].; nested exception is:
      javax.ejb.EJBException: null

      This is the way i used in my program to update the record:

      PK pk = new PK();
      pk.setBin(iBin);
      pk.setCardNum(iCardnum);
      pk.setTrdAcctno(sOldTrdAcctno);
      pk.setPreferredName(sOldPreferredName);
      ......
      .....
      Reg3rdAcc = home.findByPrimaryKey(pk);
      Reg3rdAcc.setTrdAcctno(sTrdAcctno);
      pk.setTrdAcctno(sTrdAcctno);
      Reg3rdAcc = home.findByPrimaryKey(pk);
      Reg3rdAcc.setPreferredName(sPreferredName);