What fields should be used for hashcode()/equals() in Hibernate Entities and when should I override?
Issue
- I have to create the method hashCode and equals only for the Java classes that have primary key of the entity or for all the fields of the entity including the List structure?
- What are the cases that I should implement equals() and hashCode() for hibernate Entities?
Environment
- JBoss Enterprise Application Platform (EAP)
- Hibernate
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
