I have a strange behaviour, in the context of a training exercise that aims to show the need to implement the
equals and
hashcode methods in a composite identifier class.
I instantiate a composite identifier class twice, with the same property values. Then, I invoke the
session.get method on the corresponding persistent class twice, respectively providing the first and second composite identifier instances.
As I didn't (yet) implement the
equals and
hashcode methods in the composite identifier class, I should see two SQL SELECT traces, but I only see one, for the first
session.get method invocation.
With debug trace level, I have a
Quote:
resolved object in session cache
trace. It seems that the object is resolved through comparison of the property values of the distinct composite identifier instances.
Did I miss something here ?
Any help would be highly appreciated.