Bupjae Lee wrote:
1) Check only @Id field
Drawback: Before persisting, @Id field is null; in this case, there are no way to check equality
Once you get the ID (after persisting in your case) only your object becomes complete, if id is the unique identifier for your entity, this is the best candidate.
What you are going to compare with incomplete object? even I dont think you will place it in HashMap without id.