Class RepeatableWriteUnitOfWork
- java.lang.Object
-
- org.eclipse.persistence.internal.core.sessions.CoreAbstractSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
-
- org.eclipse.persistence.internal.sessions.AbstractSession
-
- org.eclipse.persistence.internal.sessions.UnitOfWorkImpl
-
- org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork
-
- All Implemented Interfaces:
Serializable
,Cloneable
,CoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
,CommandProcessor
,Session
,UnitOfWork
- Direct Known Subclasses:
RemoteUnitOfWork
public class RepeatableWriteUnitOfWork extends UnitOfWorkImpl
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.persistence.sessions.UnitOfWork
UnitOfWork.CommitOrderType
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<ClassDescriptor>
classesToBeInvalidated
Contains classes that should be invalidated in the shared cache on commit.protected UnitOfWorkChangeSet
cumulativeUOWChangeSet
Used to store the final UnitOfWorkChangeSet for merge into the shared cacheprotected boolean
discoverUnregisteredNewObjectsWithoutPersist
Alters the behaviour of the RWUOW commit to function like the UOW with respect to Entity lifecycleprotected String
flushClearCache
The FlashClearCache mode to be used.protected boolean
isWithinFlush
Track whether we are already in a flush().protected boolean
shouldStoreBypassCache
Used to determine if we should bypass any merge into the cache.protected boolean
shouldTerminateTransaction
Used to determine if UnitOfWork should commit and rollback transactions.-
Fields inherited from class org.eclipse.persistence.internal.sessions.UnitOfWorkImpl
AfterExternalTransactionRolledBack, allClones, batchQueries, Birth, cascadeDeleteObjects, changeTrackedHardList, cloneDepth, cloneMapping, cloneToOriginals, commitOrder, CommitPending, CommitTransactionPending, containerBeans, containerUnitOfWork, CREATION_THREAD_HASHCODE, CREATION_THREAD_ID, CREATION_THREAD_NAME, Death, deferredModifyAllQueries, deletedObjects, deletedPrivateOwnedObjects, deletionDependencies, DO_NOT_THROW_CONFORM_EXCEPTIONS, Full, isNestedUnitOfWork, lastUsedMergeManager, lifecycle, LOCK_QUERIES_PROPERTY, mergeManagerForActiveMerge, MergePending, modifyAllQueries, newAggregates, newObjectsCloneToMergeOriginal, newObjectsCloneToOriginal, newObjectsInParent, newObjectsInParentOriginalToClone, newObjectsOriginalToClone, None, objectsDeletedDuringCommit, optimisticReadLockObjects, parent, Partial, pessimisticLockedObjects, preDeleteComplete, primaryKeyToNewObjects, privateOwnedObjects, ReadLockOnly, ReadLockUpdateVersion, readOnlyClasses, referenceMode, removedObjects, resumeOnTransactionCompletion, shouldCascadeCloneToJoinedRelationship, shouldDiscoverNewObjects, shouldNewObjectsBeCached, shouldPerformDeletesFirst, shouldThrowConformExceptions, shouldValidateExistence, SmartMerge, THROW_ALL_CONFORM_EXCEPTIONS, transaction, unitOfWorkChangeSet, unregisteredDeletedObjectsCloneToBackupAndOriginal, unregisteredExistingObjects, unregisteredNewObjects, unregisteredNewObjectsInParent, validationLevel, wasNonObjectLevelModifyQueryExecuted, wasTransactionBegunPrematurely, WriteChangesFailed
-
Fields inherited from class org.eclipse.persistence.internal.sessions.AbstractSession
accessors, activeCommandThreads, attributeGroups, broker, commandManager, commitManager, defaultReferenceMode, deferredEvents, descriptors, eventManager, exceptionHandler, externalTransactionController, identityMapAccessor, injectionManager, integrityChecker, isConcurrent, isExecutingEvents, isFinalizersEnabled, isInBroker, isInProfile, isLoggingOff, isSynchronized, jpaQueriesProcessed, lastDescriptorAccessed, logSessionString, metadatalistener, multitenantContextProperties, name, numberOfActiveUnitsOfWork, objectsLockedForClone, partitioningPolicy, pessimisticLockTimeoutDefault, pessimisticLockTimeoutUnitDefault, platform, profiler, project, properties, queries, queryBuilder, queryTimeoutDefault, queryTimeoutUnitDefault, serializer, sessionLog, shouldCheckWriteLock, shouldOptimizeResultSetAccess, shouldPropagateChanges, staticMetamodelClasses, tablePerTenantDescriptors, tablePerTenantQueries, tolerateInvalidJPQL, transactionMutex, wasJTSTransactionInternallyStarted
-
Fields inherited from interface org.eclipse.persistence.sessions.coordination.CommandProcessor
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING
-
-
Constructor Summary
Constructors Constructor Description RepeatableWriteUnitOfWork()
RepeatableWriteUnitOfWork(AbstractSession parentSession, ReferenceMode referenceMode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ClassDescriptor
checkHierarchyForDescriptor(Class theClass)
Check to see if the descriptor of a superclass can be used to describe this class By default, in JPA, classes must have specific descriptors to be considered entities In this implementation, we check whether the inheritance policy has been configured to allow superclass descriptors to describe subclasses that do not have a descriptor themselvesvoid
clear(boolean shouldClearCache)
INTERNAL: This method will clear all registered objects from this UnitOfWork.void
clearFlushClearCache()
INTERNAL: Clears invalidation list.void
clearForClose(boolean shouldClearCache)
INTERNAL: Call this method if the uow will no longer used for committing transactions: all the changes sets will be dereferenced, and (optionally) the cache cleared.protected Object
cloneAndRegisterNewObject(Object original, boolean isShallowClone)
INTERNAL: To avoid putting the original object into the shared cache, and therefore, impede the 'detaching' of the original after commit, a clone of the original should be registered not the actual original object.void
commitRootUnitOfWork()
INTERNAL: Commit the changes to any objects to the parent.void
commitTransaction()
INTERNAL: This is internal to the uow, transactions should not be used explicitly in a uow.void
discoverUnregisteredNewObjects(Map clones, Map newObjects, Map unregisteredExistingObjects, Map visitedObjects)
INTERNAL: Traverse the object to find references to objects not registered in this unit of work.Set<ClassDescriptor>
getClassesToBeInvalidated()
INTERNAL: Return classes that should be invalidated in the shared cache on commit.UnitOfWorkChangeSet
getCumulativeUOWChangeSet()
INTERNAL: Get the final UnitOfWorkChangeSet for merge into the shared cache.String
getFlushClearCache()
Return the FlashClearCache mode to be used.Object
getUnregisteredDeletedCloneForOriginal(Object original)
INTERNAL: Called only by UnitOfWorkIdentityMapAccessor.getAndCloneCacheKeyFromParent method.boolean
isAfterWriteChangesButBeforeCommit()
INTERNAL: Has writeChanges() been attempted on this UnitOfWork? It may have either succeeded or failed but either way the UnitOfWork is in a highly restricted state.boolean
isObjectDeleted(Object object)
INTERNAL: Return if the object has been deleted in this unit of work.void
issueSQLbeforeCompletion()
INTERNAL: For synchronized units of work, dump SQL to databaseboolean
isWithinFlush()
Return whether we are already performing a flush() callprotected void
mergeChangesIntoParent()
INTERNAL: Merge the changes to all objects to the parent.Object
mergeCloneWithReferences(Object rmiClone, MergeManager manager)
INTERNAL: Merge the attributes of the clone into the unit of work copy.Object
registerNewObject(Object newObject)
ADVANCED: Register the new object with the unit of work.protected void
registerNotRegisteredNewObjectForPersist(Object newObject, ClassDescriptor descriptor)
INTERNAL: Called only by registerNewObjectForPersist method, and only if newObject is not already registered.void
rollbackTransaction()
INTERNAL: This is internal to the uow, transactions should not be used explicitly in a uow.protected void
rollbackTransaction(boolean intendedToCommitTransaction)
INTERNAL: This is internal to the uow, transactions should not be used explicitly in a uow.void
setCumulativeUOWChangeSet(UnitOfWorkChangeSet cumulativeUOWChangeSet)
INTERNAL: Set the final UnitOfWorkChangeSet for merge into the shared cache.void
setDiscoverUnregisteredNewObjectsWithoutPersist(boolean discoverUnregisteredNewObjectsWithoutPersist)
void
setFlushClearCache(String flushClearCache)
Set the FlashClearCache mode to be used.void
setShouldStoreByPassCache(boolean shouldStoreBypassCache)
void
setShouldTerminateTransaction(boolean shouldTerminateTransaction)
boolean
shouldClearForCloseOnRelease()
INTERNAL: Indicates whether clearForClose method should be called by release method.boolean
shouldDiscoverUnregisteredNewObjectsWithoutPersist()
boolean
shouldForceReadFromDB(ObjectBuildingQuery query, Object primaryKey)
INTERNAL: Calculate whether we should read directly from the database to the UOW.boolean
shouldStoreBypassCache()
INTERNAL: Returns true if the UOW should bypass any updated to the shared cache during the merge.void
synchronizeAndResume()
INTERNAL Synchronize the clones and update their backup copies.void
updateChangeTrackersIfRequired(Object objectToWrite, ObjectChangeSet changeSetToWrite, UnitOfWorkImpl uow, ClassDescriptor descriptor)
INTERNAL: This method is used internally to update the tracked objects if requiredboolean
wasDeleted(Object original)
INTERNAL: Return if the object was deleted previously (in a flush).void
writeChanges()
INTERNAL: This will flush all changes to the database, and create or merge into the cumulativeUOWChangeSet.-
Methods inherited from class org.eclipse.persistence.internal.sessions.UnitOfWorkImpl
acquireHistoricalSession, acquireUnitOfWork, acquireWriteLocks, addDeletedPrivateOwnedObjects, addDeletionDependency, addNewAggregate, addNewObjectToPrimaryKeyToNewObjects, addNewObjectToPrimaryKeyToNewObjects, addObjectDeletedDuringCommit, addPessimisticLockedClone, addPrivateOwnedObject, addReadOnlyClass, addReadOnlyClasses, addRemovedObject, addToChangeTrackedHardList, afterExternalTransactionRollback, assignSequenceNumber, assignSequenceNumber, assignSequenceNumbers, assignSequenceNumbers, basicPrintRegisteredObjects, beginEarlyTransaction, beginTransaction, buildOriginal, calculateChanges, canChangeReadOnlySet, checkExistence, checkForUnregisteredExistingObject, checkIfAlreadyRegistered, cloneAndRegisterObject, cloneAndRegisterObject, cloneMap, collectAndPrepareObjectsForNestedMerge, commit, commitAfterWriteChanges, commitAndResume, commitAndResumeAfterWriteChanges, commitAndResumeOnFailure, commitAndResumeWithPreBuiltChangeSet, commitInternallyStartedExternalTransaction, commitNestedUnitOfWork, commitRootUnitOfWorkWithPreBuiltChangeSet, commitToDatabase, commitToDatabaseWithChangeSet, commitToDatabaseWithPreBuiltChangeSet, commitTransactionAfterWriteChanges, copyReadOnlyClasses, createCloneQueryValueHolder, createCloneTransformationValueHolder, createMap, createMap, deepMergeClone, deepRevertObject, deepUnregisterObject, discoverAllUnregisteredNewObjects, discoverAllUnregisteredNewObjectsInParent, discoverAndPersistUnregisteredNewObjects, dontPerformValidation, executeCall, forceUpdateToVersionField, getAccessor, getAccessors, getAccessors, getActiveUnitOfWork, getAllFromNewObjects, getBackupClone, getBackupClone, getBackupCloneForCommit, getBackupCloneForCommit, getBatchQueries, getCascadeDeleteObjects, getChangeTrackedHardList, getCloneMapping, getCloneToOriginals, getCommitManager, getCommitOrder, getContainerBeans, getContainerUnitOfWork, getCurrentChanges, getDefaultReadOnlyClasses, getDeletedObjects, getDeletionDependencies, getDeletionDependencies, getExecutionSession, getLifecycle, getMergeManager, getNewAggregates, getNewObjectsCloneToMergeOriginal, getNewObjectsCloneToOriginal, getNewObjectsInParentOriginalToClone, getNewObjectsOriginalToClone, getObjectFromNewObjects, getObjectFromNewObjects, getObjectsDeletedDuringCommit, getOptimisticReadLockObjects, getOriginalVersionOfNewObject, getOriginalVersionOfObject, getOriginalVersionOfObjectOrNull, getOriginalVersionOfObjectOrNull, getParent, getParentIdentityMapSession, getPessimisticLockedObjects, getPlatform, getPrimaryKeyToNewObjects, getProperty, getQuery, getQuery, getReadOnlyClasses, getReference, getReferenceMode, getRemovedObjects, getSequencing, getServerPlatform, getSessionTypeString, getShouldThrowConformExceptions, getState, getTransaction, getUnitOfWorkChangeSet, getUnregisteredExistingObjects, getUnregisteredNewObjects, getUnregisteredNewObjectsInParent, getValidationLevel, hasCascadeDeleteObjects, hasChanges, hasCloneMapping, hasCloneToOriginals, hasContainerBeans, hasDeferredModifyAllQueries, hasDeletedObjects, hasModifications, hasModifyAllQueries, hasNewObjects, hasNewObjectsInParentOriginalToClone, hasObjectsDeletedDuringCommit, hasOptimisticReadLockObjects, hasPessimisticLockedObjects, hasPrivateOwnedObjects, hasRemovedObjects, hasUnregisteredNewObjects, initializeIdentityMapAccessor, internalExecuteQuery, internalRegisterObject, isActive, isAfterWriteChangesFailed, isClassReadOnly, isCloneNewObject, isCloneNewObjectFromParent, isCommitPending, isConsideredInvalid, isDead, isInTransaction, isMergePending, isNestedUnitOfWork, isNewObjectInParent, isObjectNew, isObjectRegistered, isOriginalNewObject, isPessimisticLocked, isPreDeleteComplete, isSmartMerge, issueModifyAllQueryList, issueSQLbeforeCompletion, isUnitOfWork, isUnregisteredExistingObject, isUnregisteredNewObjectInParent, mergeBmpAndWsEntities, mergeClone, mergeClone, mergeClonesAfterCompletion, mergeCloneWithReferences, mergeCloneWithReferences, mergeCloneWithReferences, newInstance, performFullValidation, performPartialValidation, performRemove, performRemovePrivateOwnedObjectFromChangeSet, populateAndRegisterObject, postMergeChanges, preMergeChanges, printRegisteredObjects, processDeleteObjectQuery, registerAllObjects, registerAllObjects, registerExistingObject, registerExistingObject, registerExistingObject, registerNewContainerBean, registerNewContainerBeanForCMP, registerNewObject, registerNewObjectClone, registerNewObjectForPersist, registerNewObjectInIdentityMap, registerObject, registerObject, registerOriginalNewObjectFromNestedUnitOfWork, registerWithTransactionIfRequired, release, releaseJTSConnection, releaseReadConnection, releaseWriteLocks, removeAllReadOnlyClasses, removeForceUpdateToVersionField, removeObjectFromPrimaryKeyToNewObjects, removeObjectFromPrimaryKeyToNewObjects, removePrivateOwnedObject, removeReadOnlyClass, resumeUnitOfWork, retryQuery, revertAndResume, revertObject, revertObject, scanForConformingInstances, setAllClonesCollection, setBatchQueries, setCascadeDeleteObjects, setCloneMapping, setCommitOrder, setContainerBeans, setContainerUnitOfWork, setDead, setDeletedObjects, setLifecycle, setMergeManager, setNewObjectsCloneToOriginal, setNewObjectsOriginalToClone, setObjectsDeletedDuringCommit, setParent, setPendingMerge, setPreDeleteComplete, setReadOnlyClasses, setRemovedObjects, setResumeUnitOfWorkOnTransactionCompletion, setShouldCascadeCloneToJoinedRelationship, setShouldDiscoverNewObjects, setShouldNewObjectsBeCached, setShouldPerformDeletesFirst, setShouldThrowConformExceptions, setShouldValidateExistence, setSmartMerge, setSynchronized, setTransaction, setUnitOfWorkChangeSet, setUnregisteredExistingObjects, setUnregisteredNewObjects, setUnregisteredNewObjectsInParent, setupPrimaryKeyToNewObjects, setValidationLevel, setWasNonObjectLevelModifyQueryExecuted, setWasTransactionBegunPrematurely, shallowMergeClone, shallowRevertObject, shallowUnregisterObject, shouldCascadeCloneToJoinedRelationship, shouldDiscoverNewObjects, shouldNewObjectsBeCached, shouldPerformDeletesFirst, shouldPerformFullValidation, shouldPerformNoValidation, shouldPerformPartialValidation, shouldReadFromDB, shouldResumeUnitOfWorkOnTransactionCompletion, shouldValidateExistence, storeDeferredModifyAllQuery, storeModifyAllQuery, undeleteObject, unregisterObject, unregisterObject, unregisterObject, updateDerivedIds, validateObjectSpace, verifyMutexThreadIntegrityBeforeRelease, wasNonObjectLevelModifyQueryExecuted, wasTransactionBegunPrematurely, writesCompleted
-
Methods inherited from class org.eclipse.persistence.internal.sessions.AbstractSession
acquireNonSynchronizedUnitOfWork, acquireNonSynchronizedUnitOfWork, acquireRepeatableWriteUnitOfWork, acquireUnitOfWork, addAlias, addJPAQuery, addJPATablePerTenantQuery, addMultitenantContextProperty, addQuery, addQuery, addQuery, addStaticMetamodelClass, addTablePerTenantDescriptor, addTablePerTenantQuery, basicBeginTransaction, basicBeginTransaction, basicCommitTransaction, basicExecuteCall, basicRollbackTransaction, beginExternalTransaction, buildDefaultQueryBuilder, checkAndRefreshInvalidObject, cleanUpInjectionManager, clearDescriptors, clearIntegrityChecker, clearLastDescriptorAccessed, clearProfile, clone, commitExternalTransaction, compareObjects, compareObjectsDontMatch, config, containsQuery, copy, copy, copyDescriptorNamedQueries, copyDescriptorsFromProject, copyInternal, createInjectionManager, createProtectedInstanceFromCachedData, deferEvent, deleteAllObjects, deleteObject, doesObjectExist, dontLogMessages, endOperationProfile, endOperationProfile, executeDeferredEvents, executeNonSelectingCall, executeNonSelectingSQL, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeSelectingCall, executeSQL, fine, finer, finest, getActiveCommandThreads, getActiveSession, getAliasDescriptors, getAllQueries, getAsOfClause, getAttributeGroups, getBroker, getCacheKeyFromTargetSessionForMerge, getClassDescriptor, getClassDescriptor, getClassDescriptorForAlias, getCommandManager, getDatasourceLogin, getDatasourcePlatform, getDefaultReferenceMode, getDescriptor, getDescriptor, getDescriptorForAlias, getDescriptors, getEventManager, getExceptionHandler, getExceptionHandlerClass, getExternalTransactionController, getId, getIdentityMapAccessor, getIdentityMapAccessorInstance, getInjectionManager, getIntegrityChecker, getJPAQueries, getJPATablePerTenantQueries, getLoader, getLog, getLogin, getLogLevel, getLogLevel, getLogSessionString, getMappedSuperclass, getMultitenantContextProperties, getName, getNextQueryId, getNextSequenceNumberValue, getNumberOfActiveUnitsOfWork, getParentIdentityMapSession, getParentIdentityMapSession, getPartitioningPolicy, getPessimisticLockTimeoutDefault, getPessimisticLockTimeoutUnitDefault, getPlatform, getProfiler, getProject, getProperties, getQueries, getQuery, getQuery, getQueryBuilder, getQueryTimeoutDefault, getQueryTimeoutUnitDefault, getRefreshMetadataListener, getRootSession, getSerializer, getSessionForClass, getSessionForName, getSessionLog, getStaticMetamodelClass, getTablePerTenantDescriptors, getTablePerTenantQueries, getTransactionMutex, handleException, handleSevere, hasBroker, hasCommitManager, hasDescriptor, hasEventManager, hasExceptionHandler, hasExternalTransactionController, hasProperties, hasTablePerTenantDescriptors, hasTablePerTenantQueries, incrementProfile, incrementProfile, info, insertObject, isBroker, isClassReadOnly, isClientSession, isConcurrent, isConnected, isDatabaseSession, isDistributedSession, isExclusiveConnectionRequired, isExclusiveIsolatedClientSession, isFinalizersEnabled, isHistoricalSession, isInBroker, isInProfile, isIsolatedClientSession, isJPAQueriesProcessed, isLoggingOff, isProtectedSession, isRemoteSession, isRemoteUnitOfWork, isServerSession, isSessionBroker, isSynchronized, keyFromObject, load, load, log, log, log, log, log, log, log, log, logMessage, logMessage, logThrowable, postAcquireConnection, prepareDatabaseQuery, preReleaseConnection, priviledgedExecuteNonSelectingCall, priviledgedExecuteSelectingCall, processCommand, processJPAQueries, processJPAQuery, readAllObjects, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, readObject, refreshAndLockObject, refreshAndLockObject, refreshObject, registerFinalizer, releaseConnectionAfterCall, releaseUnitOfWork, removeProperty, removeQuery, removeQuery, retrieveCacheKey, retryTransaction, rollbackExternalTransaction, setAccessor, setBroker, setCommandManager, setCommitManager, setDatasourceLogin, setDefaultReferenceMode, setEventManager, setExceptionHandler, setExternalTransactionController, setInjectionManager, setIntegrityChecker, setIsConcurrent, setIsFinalizersEnabled, setIsInBroker, setIsInProfile, setJPAQueriesProcessed, setLog, setLoggingOff, setLogin, setLogin, setLogLevel, setName, setNumberOfActiveUnitsOfWork, setPartitioningPolicy, setPessimisticLockTimeoutDefault, setPessimisticLockTimeoutUnitDefault, setProfiler, setProject, setProperties, setProperty, setQueries, setQueryBuilder, setQueryTimeoutDefault, setQueryTimeoutUnitDefault, setRefreshMetadataListener, setSerializer, setSessionLog, setShouldOptimizeResultSetAccess, setShouldPropagateChanges, setTolerateInvalidJPQL, setTransactionMutex, setWasJTSTransactionInternallyStarted, severe, shouldDisplayData, shouldLog, shouldLogMessages, shouldLogMessages, shouldOptimizeResultSetAccess, shouldPropagateChanges, shouldTolerateInvalidJPQL, startOperationProfile, startOperationProfile, toString, unwrapObject, updateObject, updateProfile, updateTablePerTenantDescriptors, validateCache, validateQuery, verifyDelete, warning, wasJTSTransactionInternallyStarted, wrapObject, writeAllObjectsWithChangeSet, writeObject
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.persistence.sessions.Session
acquireUnitOfWork, addJPAQuery, addQuery, clearIntegrityChecker, clearProfile, containsQuery, copy, copy, doesObjectExist, dontLogMessages, executeNonSelectingCall, executeNonSelectingSQL, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeSelectingCall, executeSQL, getActiveSession, getAsOfClause, getClassDescriptor, getClassDescriptor, getClassDescriptorForAlias, getDatasourceLogin, getDatasourcePlatform, getDefaultReferenceMode, getDescriptor, getDescriptor, getDescriptorForAlias, getDescriptors, getEventManager, getExceptionHandler, getExternalTransactionController, getId, getIdentityMapAccessor, getIntegrityChecker, getJPAQueries, getLog, getLogin, getLogLevel, getLogLevel, getName, getNextSequenceNumberValue, getPartitioningPolicy, getPlatform, getProfiler, getProject, getProperties, getQueries, getQuery, getSerializer, getSessionLog, handleException, handleSevere, hasDescriptor, hasExceptionHandler, hasExternalTransactionController, isClientSession, isConnected, isDatabaseSession, isDistributedSession, isFinalizersEnabled, isInProfile, isRemoteSession, isRemoteUnitOfWork, isServerSession, isSessionBroker, log, logMessage, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, refreshObject, removeProperty, removeQuery, setDefaultReferenceMode, setExceptionHandler, setExternalTransactionController, setIntegrityChecker, setIsFinalizersEnabled, setLog, setLogLevel, setName, setPartitioningPolicy, setProfiler, setProperty, setQueryTimeoutDefault, setQueryTimeoutUnitDefault, setSerializer, setSessionLog, shouldLog, shouldLogMessages, validateCache
-
Methods inherited from interface org.eclipse.persistence.sessions.UnitOfWork
deleteAllObjects, deleteObject, isClassReadOnly, refreshAndLockObject, refreshAndLockObject
-
-
-
-
Field Detail
-
cumulativeUOWChangeSet
protected UnitOfWorkChangeSet cumulativeUOWChangeSet
Used to store the final UnitOfWorkChangeSet for merge into the shared cache
-
shouldTerminateTransaction
protected boolean shouldTerminateTransaction
Used to determine if UnitOfWork should commit and rollback transactions. This is used when an EntityTransaction is controlling the transaction.
-
shouldStoreBypassCache
protected boolean shouldStoreBypassCache
Used to determine if we should bypass any merge into the cache. This is a JPA flag and is true when the cacheStoreMode property is set to BYPASS. Otherwise, EclipseLink behaves as it usually would.
-
flushClearCache
protected transient String flushClearCache
The FlashClearCache mode to be used. Initialized by setUnitOfWorkChangeSet method in case it's null; commitAndResume sets this attribute back to null. Relevant only in case call to flush method followed by call to clear method.- See Also:
FlushClearCache
-
isWithinFlush
protected boolean isWithinFlush
Track whether we are already in a flush().
-
classesToBeInvalidated
protected transient Set<ClassDescriptor> classesToBeInvalidated
Contains classes that should be invalidated in the shared cache on commit. Used only in case fushClearCache == FlushClearCache.DropInvalidate: clear method copies contents of updatedObjectsClasses to this set, adding classes of deleted objects, too; on commit the classes contained here are invalidated in the shared cache and the set is cleared. Relevant only in case call to flush method followed by call to clear method. Works together with flushClearCache.
-
discoverUnregisteredNewObjectsWithoutPersist
protected boolean discoverUnregisteredNewObjectsWithoutPersist
Alters the behaviour of the RWUOW commit to function like the UOW with respect to Entity lifecycle
-
-
Constructor Detail
-
RepeatableWriteUnitOfWork
public RepeatableWriteUnitOfWork()
-
RepeatableWriteUnitOfWork
public RepeatableWriteUnitOfWork(AbstractSession parentSession, ReferenceMode referenceMode)
-
-
Method Detail
-
shouldDiscoverUnregisteredNewObjectsWithoutPersist
public boolean shouldDiscoverUnregisteredNewObjectsWithoutPersist()
- Returns:
- the discoverUnregisteredNewObjectsWithoutPersist
-
setDiscoverUnregisteredNewObjectsWithoutPersist
public void setDiscoverUnregisteredNewObjectsWithoutPersist(boolean discoverUnregisteredNewObjectsWithoutPersist)
- Parameters:
discoverUnregisteredNewObjectsWithoutPersist
- the discoverUnregisteredNewObjectsWithoutPersist to set
-
clear
public void clear(boolean shouldClearCache)
INTERNAL: This method will clear all registered objects from this UnitOfWork. If parameter value is 'true' then the cache(s) are cleared, too.- Overrides:
clear
in classUnitOfWorkImpl
-
clearForClose
public void clearForClose(boolean shouldClearCache)
INTERNAL: Call this method if the uow will no longer used for committing transactions: all the changes sets will be dereferenced, and (optionally) the cache cleared. If the uow is not released, but rather kept around for ValueHolders, then identity maps shouldn't be cleared: the parameter value should be 'false'. The lifecycle set to Birth so that uow ValueHolder still could be used. Alternatively, if called from release method then everything should go and therefore parameter value should be 'true'. In this case lifecycle won't change - uow.release (optionally) calls this method when it (uow) is already dead. The reason for calling this method from release is to free maximum memory right away: the uow might still be referenced by objects using UOWValueHolders (though they shouldn't be around they still might).- Overrides:
clearForClose
in classUnitOfWorkImpl
-
getClassesToBeInvalidated
public Set<ClassDescriptor> getClassesToBeInvalidated()
INTERNAL: Return classes that should be invalidated in the shared cache on commit. Used only in case fushClearCache == FlushClearCache.DropInvalidate: clear method copies contents of updatedObjectsClasses to this set, adding classes of deleted objects, too; on commit the classes contained here are invalidated in the shared cache and the set is cleared. Relevant only in case call to flush method followed by call to clear method. Works together with flushClearCache.
-
getCumulativeUOWChangeSet
public UnitOfWorkChangeSet getCumulativeUOWChangeSet()
INTERNAL: Get the final UnitOfWorkChangeSet for merge into the shared cache.
-
setCumulativeUOWChangeSet
public void setCumulativeUOWChangeSet(UnitOfWorkChangeSet cumulativeUOWChangeSet)
INTERNAL: Set the final UnitOfWorkChangeSet for merge into the shared cache.
-
shouldForceReadFromDB
public boolean shouldForceReadFromDB(ObjectBuildingQuery query, Object primaryKey)
INTERNAL: Calculate whether we should read directly from the database to the UOW. This will be necessary, if a flush and a clear have been called on this unit of work In that case, there will be changes in the database that are not in the shared cache, so a read in this UOW should get info directly form the DB- Overrides:
shouldForceReadFromDB
in classUnitOfWorkImpl
- See Also:
RepeatableWriteUnitOfWork
-
shouldClearForCloseOnRelease
public boolean shouldClearForCloseOnRelease()
INTERNAL: Indicates whether clearForClose method should be called by release method.- Overrides:
shouldClearForCloseOnRelease
in classUnitOfWorkImpl
-
shouldStoreBypassCache
public boolean shouldStoreBypassCache()
INTERNAL: Returns true if the UOW should bypass any updated to the shared cache during the merge.- Overrides:
shouldStoreBypassCache
in classUnitOfWorkImpl
- See Also:
RepeatableWriteUnitOfWork
-
checkHierarchyForDescriptor
protected ClassDescriptor checkHierarchyForDescriptor(Class theClass)
Check to see if the descriptor of a superclass can be used to describe this class By default, in JPA, classes must have specific descriptors to be considered entities In this implementation, we check whether the inheritance policy has been configured to allow superclass descriptors to describe subclasses that do not have a descriptor themselves- Overrides:
checkHierarchyForDescriptor
in classAbstractSession
- Parameters:
theClass
-- Returns:
- ClassDescriptor
-
commitRootUnitOfWork
public void commitRootUnitOfWork() throws DatabaseException, OptimisticLockException
INTERNAL: Commit the changes to any objects to the parent.- Overrides:
commitRootUnitOfWork
in classUnitOfWorkImpl
- Throws:
DatabaseException
OptimisticLockException
-
discoverUnregisteredNewObjects
public void discoverUnregisteredNewObjects(Map clones, Map newObjects, Map unregisteredExistingObjects, Map visitedObjects)
INTERNAL: Traverse the object to find references to objects not registered in this unit of work. Any unregistered new objects found will be persisted or an error will be thrown depending on the mapping's cascade persist. References to deleted objects will also currently cause them to be undeleted.- Overrides:
discoverUnregisteredNewObjects
in classUnitOfWorkImpl
-
isAfterWriteChangesButBeforeCommit
public boolean isAfterWriteChangesButBeforeCommit()
INTERNAL: Has writeChanges() been attempted on this UnitOfWork? It may have either succeeded or failed but either way the UnitOfWork is in a highly restricted state.- Overrides:
isAfterWriteChangesButBeforeCommit
in classUnitOfWorkImpl
-
isObjectDeleted
public boolean isObjectDeleted(Object object)
INTERNAL: Return if the object has been deleted in this unit of work.- Overrides:
isObjectDeleted
in classUnitOfWorkImpl
-
issueSQLbeforeCompletion
public void issueSQLbeforeCompletion()
INTERNAL: For synchronized units of work, dump SQL to database- Overrides:
issueSQLbeforeCompletion
in classUnitOfWorkImpl
-
mergeChangesIntoParent
protected void mergeChangesIntoParent()
INTERNAL: Merge the changes to all objects to the parent.- Overrides:
mergeChangesIntoParent
in classUnitOfWorkImpl
-
mergeCloneWithReferences
public Object mergeCloneWithReferences(Object rmiClone, MergeManager manager)
INTERNAL: Merge the attributes of the clone into the unit of work copy.- Overrides:
mergeCloneWithReferences
in classUnitOfWorkImpl
- Returns:
- the registered version for the clone being merged.
- See Also:
UnitOfWorkImpl.shallowMergeClone(Object)
,UnitOfWorkImpl.deepMergeClone(Object)
-
updateChangeTrackersIfRequired
public void updateChangeTrackersIfRequired(Object objectToWrite, ObjectChangeSet changeSetToWrite, UnitOfWorkImpl uow, ClassDescriptor descriptor)
INTERNAL: This method is used internally to update the tracked objects if required- Overrides:
updateChangeTrackersIfRequired
in classUnitOfWorkImpl
-
writeChanges
public void writeChanges()
INTERNAL: This will flush all changes to the database, and create or merge into the cumulativeUOWChangeSet.- Specified by:
writeChanges
in interfaceUnitOfWork
- Overrides:
writeChanges
in classUnitOfWorkImpl
-
registerNewObject
public Object registerNewObject(Object newObject)
ADVANCED: Register the new object with the unit of work. This will register the new object without cloning. Normally the registerObject method should be used for all registration of new and existing objects. This version of the register method can only be used for new objects. This method should only be used if a new object is desired to be registered without cloning.- Specified by:
registerNewObject
in interfaceUnitOfWork
- Overrides:
registerNewObject
in classUnitOfWorkImpl
- See Also:
UnitOfWorkImpl.registerObject(Object)
-
registerNotRegisteredNewObjectForPersist
protected void registerNotRegisteredNewObjectForPersist(Object newObject, ClassDescriptor descriptor)
INTERNAL: Called only by registerNewObjectForPersist method, and only if newObject is not already registered. If newObject is found in unregisteredDeletedObjectsCloneToBackupAndOriginal then it's re-registered, otherwise the superclass method called.- Overrides:
registerNotRegisteredNewObjectForPersist
in classUnitOfWorkImpl
-
rollbackTransaction
public void rollbackTransaction() throws DatabaseException
INTERNAL: This is internal to the uow, transactions should not be used explicitly in a uow. The uow shares its parents transactions.- Overrides:
rollbackTransaction
in classUnitOfWorkImpl
- Throws:
DatabaseException
- if the database connection is lost or the rollback fails.
-
rollbackTransaction
protected void rollbackTransaction(boolean intendedToCommitTransaction) throws DatabaseException
INTERNAL: This is internal to the uow, transactions should not be used explicitly in a uow. The uow shares its parents transactions. Called in JTA this should not set the transaction to rollback.- Overrides:
rollbackTransaction
in classUnitOfWorkImpl
- Parameters:
intendedToCommitTransaction
- whether we were inside a commit or just trying to write out changes early.- Throws:
DatabaseException
-
synchronizeAndResume
public void synchronizeAndResume()
INTERNAL Synchronize the clones and update their backup copies. Called after commit and commit and resume.- Overrides:
synchronizeAndResume
in classUnitOfWorkImpl
-
wasDeleted
public boolean wasDeleted(Object original)
INTERNAL: Return if the object was deleted previously (in a flush).- Overrides:
wasDeleted
in classUnitOfWorkImpl
-
cloneAndRegisterNewObject
protected Object cloneAndRegisterNewObject(Object original, boolean isShallowClone)
INTERNAL: To avoid putting the original object into the shared cache, and therefore, impede the 'detaching' of the original after commit, a clone of the original should be registered not the actual original object. This is a JPA override to traditional EclipseLink behavior.- Overrides:
cloneAndRegisterNewObject
in classUnitOfWorkImpl
- See Also:
UnitOfWorkImpl.registerObject(Object)
-
getUnregisteredDeletedCloneForOriginal
public Object getUnregisteredDeletedCloneForOriginal(Object original)
INTERNAL: Called only by UnitOfWorkIdentityMapAccessor.getAndCloneCacheKeyFromParent method. Return unregisteredDeletedClone corresponding to the passed original, or null
-
commitTransaction
public void commitTransaction() throws DatabaseException
INTERNAL: This is internal to the uow, transactions should not be used explicitly in a uow. The uow shares its parents transactions.- Overrides:
commitTransaction
in classUnitOfWorkImpl
- Throws:
DatabaseException
- most databases validate changes as they are done, normally errors do not occur on commit unless the disk fails or the connection is lost.
-
setShouldStoreByPassCache
public void setShouldStoreByPassCache(boolean shouldStoreBypassCache)
-
setShouldTerminateTransaction
public void setShouldTerminateTransaction(boolean shouldTerminateTransaction)
-
clearFlushClearCache
public void clearFlushClearCache()
INTERNAL: Clears invalidation list.
-
getFlushClearCache
public String getFlushClearCache()
Return the FlashClearCache mode to be used. Relevant only in case call to flush method followed by call to clear method.- See Also:
FlushClearCache
-
setFlushClearCache
public void setFlushClearCache(String flushClearCache)
Set the FlashClearCache mode to be used. Relevant only in case call to flush method followed by call to clear method.- See Also:
FlushClearCache
-
isWithinFlush
public boolean isWithinFlush()
Return whether we are already performing a flush() call- Returns:
-
-