Start here. This is the direct spoken answer to practice first.
Overview
Entity equality is difficult because database identity may arrive after the object has already entered Java collections.
An entity needs equality that stays valid as it moves between transient, managed, detached, and sometimes proxied states. Using every mutable field is unsafe because changing a field changes the hash code while the object may be inside a HashSet. Using only a generated identifier is also tricky before persistence because several new entities have no identifier yet. The implementation must reflect the entity's real stable identity and remain consistent with hashCode.