1

After migrating from Hibernate 3 to 4 I am seeing below warnings in my server logs :

composite-id class does not override equals() composite-id class does not override hashcode()

Also I am getting SQLIntegrityConstraintViolationException(Not always)

My CompositeKeyClass does not override equals() and hashcode().But I am not facing any issues with Hibernate3.

Please help me understand if the equals() and hashcode() override is required only from Hibernate 4?

Chris
  • 23
  • 7
  • It's almost always necessary to override eq/hc for correct work of any Hibernate version. Since version 4, hibernate became more verbose and does more validations. Related question: https://stackoverflow.com/questions/4388360/should-i-write-equals-and-hashcode-methods-in-jpa-entities – Petr Aleksandrov Nov 13 '19 at 18:02

1 Answers1

0

The warnings are now gone after overriding equals and hc methods. The Integrity constraint violation was not due to this.It was due to a wrong configuration in my data source.

Chris
  • 23
  • 7