Search in sources :

Example 1 with LoadFieldManager

use of org.datanucleus.store.fieldmanager.LoadFieldManager in project datanucleus-core by datanucleus.

the class StateManagerImpl method loadFieldsInFetchPlan.

/**
 * Method to load all unloaded fields in the FetchPlan.
 * Recurses through the FetchPlan objects and loads fields of sub-objects where needed.
 * Used as a precursor to detaching objects at commit since fields can't be loaded during
 * the postCommit phase when the detach actually happens.
 * @param state The FetchPlan state
 */
public void loadFieldsInFetchPlan(FetchPlanState state) {
    if ((flags & FLAG_LOADINGFPFIELDS) != 0) {
        // Already in the process of loading fields in this class so skip
        return;
    }
    flags |= FLAG_LOADINGFPFIELDS;
    try {
        // Load unloaded FetchPlan fields of this object
        loadUnloadedFieldsInFetchPlan();
        // Recurse through all fields and do the same
        int[] fieldNumbers = ClassUtils.getFlagsSetTo(loadedFields, cmd.getAllMemberPositions(), true);
        if (fieldNumbers != null && fieldNumbers.length > 0) {
            // TODO Fix this to just access the fields of the FieldManager yet this actually does a replaceField
            replaceFields(fieldNumbers, new LoadFieldManager(this, cmd.getSCOMutableMemberFlags(), myFP, state));
            updateLevel2CacheForFields(fieldNumbers);
        }
    } finally {
        flags &= ~FLAG_LOADINGFPFIELDS;
    }
}
Also used : LoadFieldManager(org.datanucleus.store.fieldmanager.LoadFieldManager)

Aggregations

LoadFieldManager (org.datanucleus.store.fieldmanager.LoadFieldManager)1