I have two objects (A e B) from the same class that are different in values (different attribute values ) but when i find B object (em.find(primary embedded key of B)) it return A. (A e B are two different object - different value for all attributes)
Example 1: (A e B are two different object - different value for all attributes)
EntityTransaction tx = em.getTransaction(); tx.begin(); em.merge(A); Object o = em.find(B); // <<--- O EQUALS A ?!?!?!?!
Example 2:
EntityTransaction tx = em.getTransaction(); tx.begin(); em.merge(A); Object o = em.merge(B); // <<--- O EQUALS A ?!?!?!?!
Example 3:
EntityTransaction tx = em.getTransaction(); tx.begin(); em.merge(A); tx.commit(); tx.begin(); Object o = em.merge(B); // <<--IT IS CORRECT!!! O EQUALS B
Hashcode and equals methods are correct. My question is: What's the method for comparison of A and B in context of single transaction? (Hashcode and equals are not used!!!) I use a composite key of three objects. (primary key is @EmbeddedId object). Every single objects have hashcode and equals methods implemented. Hibernate versions are: hibernate-entitymanager-3.5.0-Final.jar, hibernate-jpa-2.0-api-1.0.0.Final.jar, hibernate3.jar Thanks in advance
|