JPA PreUpdate fired "without" changes


stephane
 

Hi,

When I update an attribute with the same value (let's say I replace with an equals value), this object is made dirty. Not a big deal, but a side effect is PreUpdate callbacks are triggered, and I don't want because no changes need to be flushed in the storage.

Ex:
em.detach(client);
client.setName(client.getName());
em.merge(client);
=> PreUpdate callback is triggered.

Looking at the statemanager, the related field (name in the example) is made dirty which I think is the reason for triggering the PreUpdate. Are there any solution to avoid making the object dirty in such situation ? Would that offend any spec to do it ? 

thanks,

--
Stephane

Join main@datanucleus.groups.io to automatically receive all group messages.