Search in sources :

Example 1 with ObjectReferencingStoreManager

use of org.datanucleus.store.ObjectReferencingStoreManager in project datanucleus-core by datanucleus.

the class StateManagerImpl method clearNonPrimaryKeyFields.

/**
 * Method to clear all fields that are not part of the primary key of the object.
 */
public void clearNonPrimaryKeyFields() {
    try {
        getCallbackHandler().preClear(myPC);
    } finally {
        int[] nonpkFields = cmd.getNonPKMemberPositions();
        // Unset owner of any SCO wrapper so if the user holds on to a wrapper it doesn't affect the datastore
        int[] nonPkScoFields = ClassUtils.getFlagsSetTo(cmd.getSCOMutableMemberFlags(), ClassUtils.getFlagsSetTo(loadedFields, cmd.getNonPKMemberPositions(), true), true);
        if (nonPkScoFields != null) {
            provideFields(nonPkScoFields, new UnsetOwnerFieldManager());
        }
        clearFieldsByNumbers(nonpkFields);
        clearDirtyFlags(nonpkFields);
        if (myEC.getStoreManager() instanceof ObjectReferencingStoreManager) {
            // For datastores that manage the object reference
            ((ObjectReferencingStoreManager) myEC.getStoreManager()).notifyObjectIsOutdated(this);
        }
        persistenceFlags = Persistable.LOAD_REQUIRED;
        myPC.dnReplaceFlags();
        getCallbackHandler().postClear(myPC);
    }
}
Also used : UnsetOwnerFieldManager(org.datanucleus.store.fieldmanager.UnsetOwnerFieldManager) ObjectReferencingStoreManager(org.datanucleus.store.ObjectReferencingStoreManager)

Aggregations

ObjectReferencingStoreManager (org.datanucleus.store.ObjectReferencingStoreManager)1 UnsetOwnerFieldManager (org.datanucleus.store.fieldmanager.UnsetOwnerFieldManager)1