Package org.datanucleus.state
Class ReferentialStateManagerImpl
java.lang.Object
org.datanucleus.state.StateManagerImpl
org.datanucleus.state.ReferentialStateManagerImpl
- All Implemented Interfaces:
StateManager
,DNStateManager<Persistable>
Implementation of a StateManager for use where insertion ordering is important (such as RDBMS).
Adds on simple handling to be run after an object is inserted.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
Private class storing the fields to be updated for a StateManager, when it is inserted. -
Field Summary
FieldsModifier and TypeFieldDescriptionFields of this object that we must update when notified of the insertion of the related objects.private List
<ReferentialStateManagerImpl> List of StateManagers that we must notify when we have completed inserting our record.Fields inherited from class org.datanucleus.state.StateManagerImpl
cmd, currFM, dirty, dirtyFields, FLAG_ATTACHING, FLAG_BECOMING_DELETED, FLAG_CHANGING_STATE, FLAG_DELETING, FLAG_DETACHING, FLAG_DISCONNECTING, FLAG_EMBEDDED, FLAG_FLUSHED_NEW, FLAG_FLUSHING, FLAG_INSERTING, FLAG_INSERTING_CALLBACKS, FLAG_LOADINGFPFIELDS, FLAG_MAKING_TRANSIENT, FLAG_NEED_INHERITANCE_VALIDATION, FLAG_POSTINSERT_UPDATE, FLAG_POSTLOAD_PENDING, FLAG_RESETTING_DETACHED_STATE, FLAG_RESTORE_VALUES, FLAG_RETRIEVING_DETACHED_STATE, FLAG_STORING_PC, FLAG_UPDATING_EMBEDDING_FIELDS_WITH_OWNER, FLAG_VALIDATING, flags, HOLLOWFIELDMANAGER, loadedFields, myEC, myFP, myID, myInternalID, myLC, myPC, myVersion, persistenceFlags, preDeleteLoadedFields, savedState, transactionalVersion
Fields inherited from interface org.datanucleus.state.DNStateManager
MEMBER_VALUE_STORED_PREFIX, ORIGINAL_FIELD_VALUE_KEY_PREFIX
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor for object of specified type managed by the provided ExecutionContext. -
Method Summary
Modifier and TypeMethodDescriptionvoid
connect
(ExecutionContext ec, AbstractClassMetaData cmd) Method to (re)connect this StateManager to the specified ExecutionContext and object type.void
Disconnect from the ExecutionContext and persistable object.(package private) void
Method called by another StateManager when this object has registered that it needs to know when the other object has been inserted.void
Override the superclass that simply sets the INSERTING_CALLBACKS flag, and call insertion notify list.void
updateFieldAfterInsert
(Object pc, int fieldNumber) Marks the given field as being required to be updated when the specified object has been inserted.Methods inherited from class org.datanucleus.state.StateManagerImpl
areFieldsLoaded, attach, attach, attachCopy, becomingDeleted, checkInheritance, clearDirtyFlags, clearDirtyFlags, clearFields, clearFieldsByNumbers, clearLoadedFlags, clearNonPrimaryKeyFields, clearSavedFields, containsAssociatedValue, deletePersistent, detach, detachCopy, disconnectClone, enlistInTransaction, evict, evictFromTransaction, flush, getAllFieldsLoaded, getAssociatedValue, getCallbackHandler, getClassMetaData, getDirtyFieldNames, getDirtyFieldNumbers, getDirtyFields, getExecutionContext, getExecutionContextReference, getExternalObjectId, getFetchPlanForClass, getFieldNumbersOfLoadedOrDirtyFields, getInternalObjectId, getLifecycleState, getLoadedFieldNames, getLoadedFieldNumbers, getLoadedFields, getObject, getObjectAsPrintable, getObjectId, getReferencedPC, getStoreManager, getTransactionalObjectId, getTransactionalVersion, getTransactionalVersion, getVersion, getVersion, initialiseForCachedPC, initialiseForDetached, initialiseForEmbedded, initialiseForEmbedded, initialiseForHollow, initialiseForHollowAppId, initialiseForHollowPreConstructed, initialiseForPersistentClean, initialiseForPersistentNew, initialiseForPNewToBeDeleted, initialiseForTransactionalTransient, internalDeletePersistent, isAttaching, isChangingState, isConnected, isDeleted, isDeleted, isDeleting, isDetaching, isDirty, isEmbedded, isFieldLoaded, isFlushedNew, isFlushedToDatastore, isFlushing, isInserting, isLoaded, isLoaded, isNew, isPersistent, isPostLoadPending, isRestoreValues, isStoringPC, isTransactional, isVersionLoaded, isWaitingToBeFlushedToDatastore, loadField, loadFieldFromDatastore, loadFieldsFromDatastore, loadFieldsFromLevel2Cache, loadFieldsInFetchPlan, loadFieldValues, loadSpecifiedFields, loadStoredField, loadUnloadedFields, loadUnloadedFieldsInFetchPlan, loadUnloadedFieldsInFetchPlanAndVersion, loadUnloadedFieldsOfClassInFetchPlan, loadUnloadedRelationFields, locate, log, makeDirty, makeDirty, makeNontransactional, makePersistent, makePersistentTransactionalTransient, makeTransactional, makeTransient, makeTransientForReachability, markAsFlushed, markFieldsAsLoaded, markForInheritanceValidation, markPKFieldsAsLoaded, peekField, postCommit, postStateChange, postWriteField, preBegin, preRollback, preSerialize, preStateChange, preWriteField, providedBooleanField, providedByteField, providedCharField, providedDoubleField, providedFloatField, providedIntField, providedLongField, providedObjectField, providedShortField, providedStringField, provideField, provideField, provideFields, refresh, refreshFieldsInFetchPlan, refreshLoadedFields, registerTransactional, removeAssociatedValue, replaceAllLoadedSCOFieldsWithValues, replaceAllLoadedSCOFieldsWithWrappers, replaceField, replaceField, replaceField, replaceFieldMakeDirty, replaceFields, replaceFields, replaceFieldValue, replaceManagedPC, replaceNonLoadedFields, replaceStateManager, replacingBooleanField, replacingByteField, replacingCharField, replacingDetachedState, replacingDoubleField, replacingFlags, replacingFloatField, replacingIntField, replacingLongField, replacingObjectField, replacingShortField, replacingStateManager, replacingStringField, resetDetachState, restoreFields, retrieve, retrieveDetachState, saveFields, setAssociatedValue, setAttaching, setBooleanField, setByteField, setCharField, setDetaching, setDoubleField, setFloatField, setFlushedNew, setFlushing, setInserting, setIntField, setLongField, setObjectField, setPostLoadPending, setPostStoreNewObjectId, setShortField, setStoringPC, setStringField, setTransactionalVersion, setVersion, storeFieldValue, toString, transitionReadField, transitionWriteField, unloadField, unloadNonFetchPlanFields, unsetStoringPC, updateField, updateLevel2CacheForFields, updateOwnerFieldInEmbeddedField, validate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.datanucleus.enhancement.StateManager
getBooleanField, getByteField, getCharField, getDoubleField, getFloatField, getIntField, getLongField, getObjectField, getShortField, getStringField
-
Field Details
-
insertionNotifyList
List of StateManagers that we must notify when we have completed inserting our record. -
fieldsToBeUpdatedAfterObjectInsertion
private Map<ReferentialStateManagerImpl,ReferentialStateManagerImpl.FieldContainer> fieldsToBeUpdatedAfterObjectInsertionFields of this object that we must update when notified of the insertion of the related objects.
-
-
Constructor Details
-
ReferentialStateManagerImpl
Constructor for object of specified type managed by the provided ExecutionContext.- Parameters:
ec
- ExecutionContextcmd
- the metadata for the class.
-
-
Method Details
-
connect
Description copied from interface:DNStateManager
Method to (re)connect this StateManager to the specified ExecutionContext and object type.- Specified by:
connect
in interfaceDNStateManager<Persistable>
- Overrides:
connect
in classStateManagerImpl
- Parameters:
ec
- ExecutionContext to connect tocmd
- Metadata for the persistable class
-
disconnect
public void disconnect()Description copied from class:StateManagerImpl
Disconnect from the ExecutionContext and persistable object.- Specified by:
disconnect
in interfaceDNStateManager<Persistable>
- Overrides:
disconnect
in classStateManagerImpl
-
setInsertingCallbacks
public void setInsertingCallbacks()Override the superclass that simply sets the INSERTING_CALLBACKS flag, and call insertion notify list.- Specified by:
setInsertingCallbacks
in interfaceDNStateManager<Persistable>
- Overrides:
setInsertingCallbacks
in classStateManagerImpl
-
updateFieldAfterInsert
Marks the given field as being required to be updated when the specified object has been inserted.- Specified by:
updateFieldAfterInsert
in interfaceDNStateManager<Persistable>
- Overrides:
updateFieldAfterInsert
in classStateManagerImpl
- Parameters:
pc
- The Persistable objectfieldNumber
- Number of the field.
-
insertionCompleted
Method called by another StateManager when this object has registered that it needs to know when the other object has been inserted.- Parameters:
op
- StateManager of the other object that has just been inserted
-