It's not related to the disposable OA idea, I guess. 

There is one remaining reference to changing the pojo in an OA which is from 
the PersistenceSession implementation, when calling 
`objectAdapterContext.remapAsPersistent(adapter, persistentOid, this);` in ...

```java
/**
     * Called either when an entity is initially persisted, or when an entity 
is updated;
     * fires the appropriate lifecycle callback
     *
     * <p>
     * The implementation therefore uses Isis' {@link 
org.apache.isis.core.metamodel.adapter.oid.Oid#isTransient() oid}
     * to determine which callback to fire.
     */
    @Override
    public void 
enlistCreatedAndRemapIfRequiredThenInvokeIsisInvokePersistingOrUpdatedCallback(final
 Persistable pojo) {
        final ObjectAdapter adapter = adapterFor(pojo);

        final RootOid rootOid = (RootOid) adapter.getOid(); // ok since this is 
for a Persistable

        if (rootOid.isTransient()) {
            // persisting
            final RootOid persistentOid = 
objectAdapterContext.createPersistentOrViewModelOid(pojo);

            objectAdapterContext.remapAsPersistent(adapter, persistentOid, 
this);

            CallbackFacet.Util.callCallback(adapter, 
PersistedCallbackFacet.class);
            postLifecycleEventIfRequired(adapter, 
PersistedLifecycleEventFacet.class);

            changedObjectsServiceInternal.enlistCreated(adapter);

        } else {
            // updating;
            // the callback and transaction.enlist are done in the preDirty 
callback
            // (can't be done here, as the enlist requires to capture the 
'before' values)
            CallbackFacet.Util.callCallback(adapter, 
UpdatedCallbackFacet.class);
            postLifecycleEventIfRequired(adapter, 
UpdatedLifecycleEventFacet.class);
        }

        Version versionIfAny = getVersionIfAny(pojo);
        adapter.setVersion(versionIfAny);
    }
```

[ Full content available at: https://github.com/apache/isis/pull/121 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to