I know of no reason to create equals and hashcode methods for objects serialized by the HTTP - Servlet API session mechanisms. After all, it is the String name that is used to recover the object reference.
William Brogden wrote:I know of no reason to create equals and hashcode methods for objects serialized by the HTTP - Servlet API session mechanisms. After all, it is the String name that is used to recover the object reference.
For clusters, you need to implement Serializable to be able to write to and read from disk. I don't see why you would need equals() and hashCode() though.
It is a popular misconception that hashCode provides a unique identifier for an object. It does not. hashCode and equals are used for Object equality comparisons, not serialized retrieval.