datanucleus-core
datanucleus-core copied to clipboard
Detaching an object graph with a Map and an overridden hashcode() in the map key fails when the key is being detached
Attached project demonstrates that PersistenceManager.detachCopy(Object) fails when the object graph has these properties:
- There is a loop
- The loop contains a Map key
- The Map key has hashcode() overridden
The reason detaching fails is that the instance added to the Map is still being detached (the fields are not set yet).
It is possible that this issue cannot be fixed due to the nature of the object graph, and the requirement of JDO to detach a copy. DN_FailingDetach.zip
Detaching the same object graph at the end of a transaction (i.e. in-place) works perfectly. The settings for this are: javax.jdo.option.DetachAllOnCommit=true javax.jdo.option.RetainValues=true