The discussion of equals() and hashCode() in the next-to-last paragraph on page 125 is either unclear. It reads:
Quote:
You might have noticed that the equals() and hashCode() methods always access the properties of the other object via the getter methods.
However, the code sample provided above on the same page clearly does not use a getter method in the implementation of hashCode().
Is the code sample wrong? Or is the statement wrong? The paragraph continues by saying "This is important, since the object instance passed as other might be a proxy object, not the actual instance that holds the persistent state" which could lead one to believe that getter methods aren't really required for hashCode() (since there obviously is no other instance passed to hashCode()).
What's the right thing to do for hashCode()?