As far as I understand(correct me if I am wrong) Hibernate uses object reference to check the object equality. When Hibernate identifies that there are more than one objects attached to same DB record, it throws following exception.
"a different object with the same identifier value was already associated with the session"
My question is, does Hibernate use equal()
method to check the object equality (The default equal method uses object reference)? If it is true, will overridden equal()
method change the Hibernate behavior?
Note: My question is not about the issues of implementing equal()
or hashCode()
methods in a Hibernate persisted object.
Thank you.