Having such problem. Loaded collection of 2 objects (by primary key, using criteria). Then iterating them in the loop. When processing first object, somewhere very very far from this loop, is loaded object by same primary key as second object in loop. Here I see that System.identityHashCode() are different for this 2 objects. When processing second object from loop and trying to save it I get exception:
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session:
Trying to simulate this problem with simple object, loading , modifying, once more loading by PK, saving with different transaction propogation-s I always get same object instance... Could you please tell when it is possible to get second object instance in same session loading by PK?