0 Replies Latest reply on Apr 26, 2005 12:52 PM by Nick Newman

    Why isIdentical instead of equals?

    Nick Newman Newbie

      I understand that the EJB spec says that you have to use isIdentical instead of equals to compare two entities, but I'm curious about why this is. After all, if you have an isIdentical method, can't equals be implemented along the following (pseudo-code) lines?

      public boolean equals(Object o) {
       if( o is an instance of an EJB )
       return this.isIdentical( (cast-to-EJB) o);
       else
       return false;
       }
      

      There must be a good reason. I just can't think what it is!

      Thanks,
      Nick