December 2013
Beginner to intermediate
446 pages
9h 9m
English
Our domain layer entity classes have autogenerated equals and
hashCode methods defined. The Company class, for example, defines these methods as shown:

It is best practice to always provide correctly implemented equals and hashCode methods that use the entity ID to calculate the value that is returned. These methods are used by JPA to determine the equality between entities. Our autogenerated equals method will work correctly with JPA as the ID entity is used in the comparison for each method. However, the //TODO: Warning message on line 83 (see the previous screenshot) indicates an issue that can be avoided ...
Read now
Unlock full access