Issue #1300: preUpdate-methods are called when there is no change

Type: Bug ReoprtVersion: 2.5.3Priority: NormalStatus: ClosedReplies: 1

Dear Support Team,

we ran into some difficulties with a database. When fetching a entity using the EntityManager and afterwards calling "iterator().next()" a transaction begin/commit will end up in updating the Entity even there was no change.

RepositoryModelData repository = connection.find(RepositoryModelData.class, 1);
connection.getTransaction().commit(); // --> will result in a call of @PreUpdate annotated methods

We attached a simplified test case where only 2 reduced versions of the entities are available. But it still shows the unexpected behavior. To reproduce just run the "EntryPoint" class.




This seems to be a side effect of using a HashSet of objects with no user defined hashCode method.

Objects in a persistent HashSet (and key objects in a persistent HashMap) should have a meaningful hashCode and equals methods based on the object id or content (and not the methods that are inherited from java.lang.Object, which are based on the object address, which is not fixed).

ObjectDB Support