1 Reply Latest reply on Sep 19, 2002 3:36 PM by Dain Sundstrom

    CMP remove() problem

    cfg123 Newbie

      i faced this problem when want to remove a record from CMP entity bean.

      17:31:19,946 ERROR [STDERR] java.rmi.ServerException: Internal error getting prima
      y key field member Bin
      Embedded Exception
      object is not an instance of declaring class; nested exception is:
      javax.ejb.EJBException: Internal error getting primary key field member Bi
      Embedded Exception
      object is not an instance of declaring class

      This is the way i used to remove the record. Is anything wrong here?

      PK pk = new PK();
      pk.setBin(iBin);
      pk.setCardNum(iCardnum);
      pk.setPayeeCD(sPayeeCD);
      pk.setRefNo(sOldRefNo);
      pk.setRefName(sOldRefName);

      Context initial = new InitialContext();
      Object objRef = initial.lookup("PayReg/PayRegEJB");
      PayRegHome home = (PayRegHome) PortableRemoteObject.narrow(objRef, PayRegHome.class);
      PayReg PayReg=null;

      PayReg = home.findByPrimaryKey(pk);
      home.remove(PayReg);