datanucleus-core
datanucleus-core copied to clipboard
Add option of detaching wrappers of SCO classes, so allowing change tracking whilst detached
The current SCO wrappers don't have a way of marking the owning object as having the particular field as dirty when a mutator method is called. e.g if we have a Collection field and whilst detached the user calls collection.add(...).
The changes needed are : Enhancer : jdoMakeDirty - if detached (jdoStateManager == null && jdoDetachedState != null) then update the detached state for that field Wrapper classes : makeDirty - if no ObjectProvider then call pc.jdoMakeDirty(fieldName).
With SVN trunk at 26/05/2009 the user can use "detachAllOnCommit" and the persistence property "datanucleus.detachAsWrapped" as "true" and will detach wrappers for SCOs. This will then keep track on dirty fields whilst detached (hence the attach can be optimised)
Taken from NUCCORE-1025. "Currently we default to detaching the raw java types for collection/map fields. There is a persistence property to allow detach (under some circumstances) with SCO wrappers for Collection/Map fields. The next logical step is to save a dirty flag when detached (i.e no owner) and allow the re-attach (need a setOwner method on the SCO)". Merged these two issues