public class UnitOfWorkImpl extends AbstractSession implements UnitOfWork
Purpose: To allow object level transactions.
Description: The unit of work is a session that implements all of the normal
protocol of an EclipseLink session. It can be spawned from any other session including another unit of work.
Objects can be brought into the unit of work through reading them or through registering them.
The unit of work will operate on its own object space, that is the objects within the unit of work
will be clones of the original objects. When the unit of work is committed, all changes to any objects
registered within the unit of work will be committed to the database. A minimal commit/update will
be performed and any foreign keys/circular reference/referential integrity will be resolved.
If the commit to the database is successful the changed objects will be merged back into the unit of work
parent session.
Responsibilities:
- Allow parallel transactions against a session's objects.
- Allow nested transactions.
- Not require the application to write objects that is changes, automatically determine what has changed.
- Perform a minimal commit/update of all changes that occurred.
- Resolve foreign keys for newly created objects and maintain referential integrity.
- Allow for the object transaction to use its own object space.
,
Serialized FormUnitOfWork.CommitOrderType
Modifier and Type | Field and Description |
---|---|
static int |
AfterExternalTransactionRolledBack |
static int |
Birth |
static int |
CommitPending |
static int |
CommitTransactionPending |
static int |
Death |
static int |
DO_NOT_THROW_CONFORM_EXCEPTIONS
Used for Conforming Queries
|
static int |
Full |
static java.lang.String |
LOCK_QUERIES_PROPERTY |
static int |
MergePending |
static int |
None |
static int |
Partial |
static java.lang.String |
ReadLockOnly
Used for read lock to determine update the version field with the same value or increment value
|
static java.lang.String |
ReadLockUpdateVersion |
static int |
THROW_ALL_CONFORM_EXCEPTIONS |
static int |
WriteChangesFailed |
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING
Constructor and Description |
---|
UnitOfWorkImpl()
INTERNAL:
|
UnitOfWorkImpl(AbstractSession parent,
ReferenceMode referenceMode)
INTERNAL:
Create and return a new unit of work with the session as its parent.
|
Modifier and Type | Method and Description |
---|---|
Session |
acquireHistoricalSession(AsOfClause clause)
INTERNAL:
Acquires a special historical session for reading objects as of a past time.
|
UnitOfWorkImpl |
acquireUnitOfWork()
PUBLIC:
Return a nested unit of work for this unit of work.
|
void |
addDeletedPrivateOwnedObjects(DatabaseMapping mapping,
java.lang.Object object)
INTERNAL:
Records a private owned object that has been de-referenced and will need to processed
for related private owned objects.
|
void |
addDeletionDependency(java.lang.Object target,
java.lang.Object source)
INTERNAL:
Record deleted objects that have reference to other deleted objects.
|
void |
addNewAggregate(java.lang.Object originalObject)
INTERNAL:
Register a new aggregate object with the unit of work.
|
void |
addObjectDeletedDuringCommit(java.lang.Object object,
ClassDescriptor descriptor)
INTERNAL:
Add object deleted during root commit of unit of work.
|
void |
addPessimisticLockedClone(java.lang.Object clone)
INTERNAL:
|
void |
addPrivateOwnedObject(DatabaseMapping mapping,
java.lang.Object privateOwnedObject)
INTERNAL:
Add a privately owned object to the privateOwnedObjectsMap.
|
void |
addReadOnlyClass(java.lang.Class theClass)
PUBLIC:
Adds the given Java class to the receiver's set of read-only classes.
|
void |
addReadOnlyClasses(java.util.Collection classes)
PUBLIC:
Adds the classes in the given Vector to the existing set of read-only classes.
|
void |
addRemovedObject(java.lang.Object orignal)
INTERNAL:
Register that an object was removed in a nested unit of work.
|
void |
addToChangeTrackedHardList(java.lang.Object obj) |
void |
afterExternalTransactionRollback()
INTERNAL:
Called after external transaction rolled back.
|
void |
assignSequenceNumber(java.lang.Object object)
ADVANCED:
Assign sequence number to the object.
|
java.lang.Object |
assignSequenceNumber(java.lang.Object object,
ClassDescriptor descriptor)
INTERNAL:
Assign sequence number to the object.
|
void |
assignSequenceNumbers()
ADVANCED:
Assign sequence numbers to all new objects registered in this unit of work,
or any new objects reference by any objects registered.
|
void |
beginEarlyTransaction()
PUBLIC:
Tell the unit of work to begin a transaction now.
|
void |
beginTransaction()
INTERNAL:
This is internal to the uow, transactions should not be used explicitly in a uow.
|
java.lang.Object |
buildOriginal(java.lang.Object workingClone)
INTERNAL:
Unregistered new objects have no original so we must create one for commit and resume and
to put into the parent.
|
UnitOfWorkChangeSet |
calculateChanges(java.util.Map registeredObjects,
UnitOfWorkChangeSet changeSet,
boolean assignSequences,
boolean shouldCloneMap)
INTERNAL:
|
java.lang.Object |
checkExistence(java.lang.Object object)
INTERNAL: Register the object and return the clone if it is existing
otherwise return null if it is new.
|
boolean |
checkForUnregisteredExistingObject(java.lang.Object object)
INTERNAL:
Return if the object is an existing object (but has not been registered),
or a new object (that has not be persisted).
|
java.lang.Object |
checkIfAlreadyRegistered(java.lang.Object object,
ClassDescriptor descriptor)
INTERNAL:
Return the value of the object if it already is registered, otherwise null.
|
void |
clear(boolean shouldClearCache)
INTERNAL:
This method will clear all registered objects from this UnitOfWork.
|
void |
clearForClose(boolean shouldClearCache)
INTERNAL:
Call this method if the uow will no longer be used for committing transactions:
all the change sets will be dereferenced, and (optionally) the cache cleared.
|
java.lang.Object |
cloneAndRegisterObject(java.lang.Object original,
CacheKey parentCacheKey,
CacheKey unitOfWorkCacheKey,
ClassDescriptor descriptor)
INTERNAL:
Clone and register the object.
|
java.lang.Object |
cloneAndRegisterObject(java.lang.Object original,
CacheKey parentCacheKey,
ClassDescriptor descriptor)
INTERNAL:
Clone and register the object.
|
java.util.Map |
collectAndPrepareObjectsForNestedMerge()
INTERNAL:
Prepare for merge in nested uow.
|
void |
commit()
PUBLIC:
Commit the unit of work to its parent.
|
void |
commitAndResume()
PUBLIC:
Commit the unit of work to its parent.
|
void |
commitAndResumeOnFailure()
PUBLIC:
Commit the unit of work to its parent.
|
void |
commitAndResumeWithPreBuiltChangeSet(UnitOfWorkChangeSet uowChangeSet)
INTERNAL:
This method is used by the MappingWorkbench for their read-only file feature
this method must not be exposed to or used by customers until it has been revised
and the feature revisited to support OptimisticLocking and Serialization
|
void |
commitRootUnitOfWork()
INTERNAL:
Commit the changes to any objects to the parent.
|
void |
commitRootUnitOfWorkWithPreBuiltChangeSet(UnitOfWorkChangeSet uowChangeSet)
INTERNAL:
This method is used by the MappingWorkbench read-only files feature
It will commit a pre-built unitofwork change set to the database
|
void |
commitTransaction()
INTERNAL:
This is internal to the uow, transactions should not be used explicitly in a uow.
|
void |
commitTransactionAfterWriteChanges()
INTERNAL:
After writeChanges() everything has been done except for committing
the transaction.
|
java.util.Vector |
copyReadOnlyClasses()
INTERNAL:
Copy the read only classes from the unit of work.
|
DatabaseValueHolder |
createCloneQueryValueHolder(ValueHolderInterface attributeValue,
java.lang.Object clone,
AbstractRecord row,
ForeignReferenceMapping mapping) |
DatabaseValueHolder |
createCloneTransformationValueHolder(ValueHolderInterface attributeValue,
java.lang.Object original,
java.lang.Object clone,
AbstractTransformationMapping mapping) |
java.lang.Object |
deepMergeClone(java.lang.Object rmiClone)
PUBLIC:
Merge the attributes of the clone into the unit of work copy.
|
java.lang.Object |
deepRevertObject(java.lang.Object clone)
PUBLIC:
Revert the object's attributes from the parent.
|
void |
deepUnregisterObject(java.lang.Object clone)
ADVANCED:
Unregister the object with the unit of work.
|
void |
discoverAndPersistUnregisteredNewObjects(java.lang.Object object,
boolean cascadePersist,
java.util.Map newObjects,
java.util.Map unregisteredExistingObjects,
java.util.Map visitedObjects,
java.util.Set cascadeErrors)
INTERNAL:
Discover any new objects referenced from registered objects and persist them.
|
void |
discoverUnregisteredNewObjects(java.util.Map clones,
java.util.Map knownNewObjects,
java.util.Map unregisteredExistingObjects,
java.util.Map visitedObjects)
INTERNAL:
Traverse the object to find references to objects not registered in this unit of work.
|
void |
dontPerformValidation()
ADVANCED:
The unit of work performs validations such as,
ensuring multiple copies of the same object don't exist in the same unit of work,
ensuring deleted objects are not referred after commit,
ensures that objects from the parent cache are not referred in the unit of work cache.
|
java.lang.Object |
executeCall(Call call,
AbstractRecord translationRow,
DatabaseQuery query)
INTERNAL:
Override From session.
|
void |
forceUpdateToVersionField(java.lang.Object lockObject,
boolean shouldModifyVersionField)
ADVANCED:
Set optimistic read lock on the object.
|
Accessor |
getAccessor()
INTERNAL:
The uow does not store a local accessor but shares its parents.
|
java.util.Collection<Accessor> |
getAccessors()
INTERNAL:
The uow does not store a local accessor but shares its parents.
|
java.util.Collection<Accessor> |
getAccessors(Call call,
AbstractRecord translationRow,
DatabaseQuery query)
INTERNAL:
Return the connections to use for the query execution.
|
UnitOfWork |
getActiveUnitOfWork()
PUBLIC:
Return the active unit of work for the current active external (JTS) transaction.
|
java.util.Vector |
getAllFromNewObjects(Expression selectionCriteria,
java.lang.Class theClass,
AbstractRecord translationRow,
int valueHolderPolicy)
INTERNAL:
Return any new objects matching the expression.
|
java.lang.Object |
getBackupClone(java.lang.Object clone)
INTERNAL:
Return the backup clone for the working clone.
|
java.lang.Object |
getBackupClone(java.lang.Object clone,
ClassDescriptor descriptor)
INTERNAL:
Return the backup clone for the working clone.
|
java.lang.Object |
getBackupCloneForCommit(java.lang.Object clone)
INTERNAL:
Return the backup clone for the working clone.
|
java.lang.Object |
getBackupCloneForCommit(java.lang.Object clone,
ClassDescriptor descriptor)
INTERNAL:
Return the backup clone for the working clone.
|
java.util.Map<ReadQuery,ReadQuery> |
getBatchQueries()
INTERNAL:
When in transaction batch read objects must use query local
to the unit of work.
|
java.util.Set<java.lang.Object> |
getCascadeDeleteObjects()
INTERNAL:
Return any objects have been deleted through database cascade delete constraints.
|
java.util.Set<java.lang.Object> |
getChangeTrackedHardList()
INTERNAL:
Return the list of object with changes.
|
java.util.Map |
getCloneMapping()
INTERNAL:
Return the clone mapping.
|
java.util.Map |
getCloneToOriginals()
INTERNAL:
Map used to avoid garbage collection in weak caches.
|
CommitManager |
getCommitManager()
INTERNAL:
The commit manager is used to resolve referential integrity on commits of multiple objects.
|
UnitOfWork.CommitOrderType |
getCommitOrder()
ADVANCED:
Return the commit order.
|
java.util.Map |
getContainerBeans()
INTERNAL:
This is only used for EJB entity beans to manage beans accessed in a transaction context.
|
UnitOfWorkImpl |
getContainerUnitOfWork()
INTERNAL:
This is only used for EJB entity beans to manage beans accessed in a transaction context.
|
UnitOfWorkChangeSet |
getCurrentChanges()
ADVANCED:
This method Will Calculate the changes for the UnitOfWork.
|
java.util.Vector |
getDefaultReadOnlyClasses()
INTERNAL: Returns the set of read-only classes that gets assigned to each newly created UnitOfWork.
|
java.util.Map |
getDeletedObjects()
INTERNAL:
The deleted objects stores any objects removed during the unit of work.
|
java.util.Map<java.lang.Object,java.util.Set<java.lang.Object>> |
getDeletionDependencies()
INTERNAL:
Return deleted objects that have reference to other deleted objects.
|
java.util.Set<java.lang.Object> |
getDeletionDependencies(java.lang.Object deletedObject)
INTERNAL:
Return references to other deleted objects for this deleted object.
|
AbstractSession |
getExecutionSession(DatabaseQuery query)
INTERNAL:
Gets the session which this query will be executed on.
|
int |
getLifecycle()
INTERNAL:
The life cycle tracks if the unit of work is active and is used for JTS.
|
MergeManager |
getMergeManager()
A reference to the last used merge manager.
|
java.util.Map |
getNewAggregates()
INTERNAL:
The map stores any new aggregates that have been cloned.
|
java.util.Map |
getNewObjectsCloneToMergeOriginal()
INTERNAL:
The stores a map from new object clones to the original object used from merge.
|
java.util.Map |
getNewObjectsCloneToOriginal()
INTERNAL:
The new objects stores any objects newly created during the unit of work.
|
java.util.Map |
getNewObjectsInParentOriginalToClone()
INTERNAL:
The returns the list that will hold the new objects from the Parent UnitOfWork
|
java.util.Map |
getNewObjectsOriginalToClone()
INTERNAL:
The new objects stores any objects newly created during the unit of work.
|
java.lang.Object |
getObjectFromNewObjects(java.lang.Class theClass,
java.lang.Object selectionKey)
INTERNAL:
Return any new object matching the expression.
|
java.lang.Object |
getObjectFromNewObjects(Expression selectionCriteria,
java.lang.Class theClass,
AbstractRecord translationRow,
int valueHolderPolicy)
INTERNAL:
Return any new object matching the expression.
|
java.util.Map |
getObjectsDeletedDuringCommit()
INTERNAL:
Returns all the objects which are deleted during root commit of unit of work.
|
java.util.Map |
getOptimisticReadLockObjects()
INTERNAL:
Return optimistic read lock objects
|
java.lang.Object |
getOriginalVersionOfNewObject(java.lang.Object workingClone)
INTERNAL:
Return the original version of the new object (working clone).
|
java.lang.Object |
getOriginalVersionOfObject(java.lang.Object workingClone)
ADVANCED:
Return the original version of the object(clone) from the parent's identity map.
|
java.lang.Object |
getOriginalVersionOfObjectOrNull(java.lang.Object workingClone,
ClassDescriptor descriptor)
INTERNAL:
Return the original version of the object(clone) from the parent's identity map.
|
java.lang.Object |
getOriginalVersionOfObjectOrNull(java.lang.Object workingClone,
ObjectChangeSet changeSet,
ClassDescriptor descriptor,
AbstractSession targetSession)
INTERNAL:
Return the original version of the object(clone) from the parent's identity map.
|
AbstractSession |
getParent()
PUBLIC:
Return the parent.
|
AbstractSession |
getParentIdentityMapSession(ClassDescriptor descriptor,
boolean canReturnSelf,
boolean terminalOnly)
INTERNAL:
Returns the appropriate IdentityMap session for this descriptor.
|
java.util.Map |
getPessimisticLockedObjects()
INTERNAL:
|
Platform |
getPlatform(java.lang.Class domainClass)
INTERNAL:
Return the platform for a particular class.
|
java.lang.Object |
getProperty(java.lang.String name)
INTERNAL:
Search for and return the user defined property from this UOW, if it not found then search for the property
from parent.
|
DatabaseQuery |
getQuery(java.lang.String name)
PUBLIC:
Return the query from the session pre-defined queries with the given name.
|
DatabaseQuery |
getQuery(java.lang.String name,
java.util.Vector arguments)
PUBLIC:
Return the query from the session pre-defined queries with the given name.
|
java.util.Set |
getReadOnlyClasses()
ADVANCED:
Returns the set of read-only classes in this UnitOfWork.
|
java.lang.Object |
getReference(java.lang.Class theClass,
java.lang.Object id)
Get an instance, whose state may be lazily fetched.
|
ReferenceMode |
getReferenceMode() |
Sequencing |
getSequencing()
INTERNAL:
Return the Sequencing object used by the session.
|
ServerPlatform |
getServerPlatform()
INTERNAL:
Marked internal as this is not customer API but helper methods for
accessing the server platform from within EclipseLink's other sessions types
(i.e.
|
java.lang.String |
getSessionTypeString()
INTERNAL:
Returns the type of session, its class.
|
int |
getShouldThrowConformExceptions()
INTERNAL:
Return whether to throw exceptions on conforming queries
|
int |
getState()
INTERNAL:
Find out what the lifecycle state of this UoW is in.
|
java.lang.Object |
getTransaction()
INTERNAL:
PERF: Return the associated external transaction.
|
UnitOfWorkChangeSet |
getUnitOfWorkChangeSet()
ADVANCED:
Returns the currentChangeSet from the UnitOfWork.
|
java.util.Map |
getUnregisteredExistingObjects()
INTERNAL:
Used to lazy Initialize the unregistered existing Objects collection.
|
int |
getValidationLevel()
ADVANCED:
The unit of work performs validations such as,
ensuring multiple copies of the same object don't exist in the same unit of work,
ensuring deleted objects are not referred after commit,
ensures that objects from the parent cache are not referred in the unit of work cache.
|
boolean |
hasCascadeDeleteObjects()
INTERNAL:
Return if any objects have been deleted through database cascade delete constraints.
|
boolean |
hasChanges()
ADVANCED:
The Unit of work is capable of preprocessing to determine if any on the clone have been changed.
|
boolean |
hasCloneMapping()
INTERNAL:
Return if the unit of work has any clones.
|
boolean |
hasContainerBeans()
INTERNAL:
Return if any container beans exist.
|
boolean |
hasDeletedObjects()
INTERNAL:
The deleted objects stores any objects removed during the unit of work.
|
boolean |
hasNewObjects()
INTERNAL:
Return if there are any registered new objects.
|
boolean |
hasOptimisticReadLockObjects()
INTERNAL:
Return if there are any optimistic read locks.
|
boolean |
hasPessimisticLockedObjects()
INTERNAL:
Return true if there are any pessimistic locked objects in this unit of work, false otherwise.
|
boolean |
hasPrivateOwnedObjects()
INTERNAL:
Return true if privateOwnedObjects is not null and not empty, false otherwise.
|
boolean |
hasUnregisteredNewObjects()
INTERNAL:
Return if there are any unregistered new objects.
|
void |
initializeIdentityMapAccessor()
INTERNAL:
Set up the IdentityMapManager.
|
java.lang.Object |
internalExecuteQuery(DatabaseQuery query,
AbstractRecord databaseRow)
INTERNAL:
Return the results from executing the database query.
|
java.lang.Object |
internalRegisterObject(java.lang.Object object,
ClassDescriptor descriptor,
boolean isShallowClone)
INTERNAL:
Register the object with the unit of work.
|
boolean |
isActive()
PUBLIC:
Return if the unit of work is active.
|
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 |
isClassReadOnly(java.lang.Class theClass,
ClassDescriptor descriptor)
INTERNAL:
Checks to see if the specified class or descriptor is read-only or not in this UnitOfWork.
|
boolean |
isCloneNewObject(java.lang.Object clone)
INTERNAL:
Check if the object is already registered.
|
boolean |
isCloneNewObjectFromParent(java.lang.Object clone)
INTERNAL:
Check if the object is already registered in a parent Unit Of Work
|
boolean |
isCommitPending()
INTERNAL:
Return if the unit of work is waiting to be committed or in the process of being committed.
|
boolean |
isConsideredInvalid(java.lang.Object object,
CacheKey cacheKey,
ClassDescriptor descriptor)
INTERNAL:
Check if the object is invalid and *should* be refreshed.
|
boolean |
isDead()
INTERNAL:
Return if the unit of work is dead.
|
boolean |
isInTransaction()
PUBLIC:
Return whether the session currently has a database transaction in progress.
|
boolean |
isMergePending()
INTERNAL:
Return if the unit of work is waiting to be merged or in the process of being merged.
|
boolean |
isNestedUnitOfWork()
PUBLIC:
Return whether this session is a nested unit of work or not.
|
boolean |
isNewObjectInParent(java.lang.Object clone)
INTERNAL:
This method determines if the specified clone is new in the parent UnitOfWork
|
boolean |
isObjectDeleted(java.lang.Object object)
INTERNAL:
Return if the object has been deleted in this unit of work.
|
boolean |
isObjectNew(java.lang.Object clone)
INTERNAL:
This method is used to determine if the clone is a new Object in the UnitOfWork
|
boolean |
isObjectRegistered(java.lang.Object clone)
ADVANCED:
Return whether the clone object is already registered.
|
boolean |
isOriginalNewObject(java.lang.Object original)
INTERNAL:
Return whether the original object is new.
|
boolean |
isPessimisticLocked(java.lang.Object clone)
INTERNAL:
Return if the clone has been pessimistic locked in this unit of work.
|
boolean |
isPreDeleteComplete() |
static boolean |
isSmartMerge()
INTERNAL:
Return the status of smart merge
|
void |
issueSQLbeforeCompletion()
INTERNAL:
For synchronized units of work, dump SQL to database.
|
void |
issueSQLbeforeCompletion(boolean commitTransaction)
INTERNAL:
For synchronized units of work, dump SQL to database.
|
boolean |
isUnitOfWork()
PUBLIC:
Return if this session is a unit of work.
|
boolean |
isUnregisteredExistingObject(java.lang.Object object)
INTERNAL:
Return if the object is a known unregistered existing object.
|
boolean |
isUnregisteredNewObjectInParent(java.lang.Object originalObject)
INTERNAL:
Return if the object was existing but not registered in the parent of the nested unit of work.
|
java.lang.Object |
mergeClone(java.lang.Object rmiClone)
PUBLIC:
Merge the attributes of the clone into the unit of work copy.
|
java.lang.Object |
mergeClone(java.lang.Object rmiClone,
int cascadeDepth,
boolean forRefresh)
INTERNAL:
Merge the attributes of the clone into the unit of work copy.
|
void |
mergeClonesAfterCompletion()
INTERNAL:
for synchronized units of work, merge changes into parent
|
java.lang.Object |
mergeCloneWithReferences(java.lang.Object rmiClone)
PUBLIC:
Merge the attributes of the clone into the unit of work copy.
|
java.lang.Object |
mergeCloneWithReferences(java.lang.Object rmiClone,
int cascadePolicy)
PUBLIC:
Merge the attributes of the clone into the unit of work copy.
|
java.lang.Object |
mergeCloneWithReferences(java.lang.Object rmiClone,
int cascadePolicy,
boolean forceCascade)
INTERNAL:
Merge the attributes of the clone into the unit of work copy.
|
java.lang.Object |
mergeCloneWithReferences(java.lang.Object rmiClone,
MergeManager manager)
INTERNAL:
Merge the attributes of the clone into the unit of work copy.
|
java.lang.Object |
newInstance(java.lang.Class theClass)
PUBLIC:
Return a new instance of the class registered in this unit of work.
|
void |
performFullValidation()
ADVANCED:
The unit of work performs validations such as,
ensuring multiple copies of the same object don't exist in the same unit of work,
ensuring deleted objects are not referred after commit,
ensures that objects from the parent cache are not referred in the unit of work cache.
|
void |
performPartialValidation()
ADVANCED:
The unit of work performs validations such as,
ensuring multiple copies of the same object don't exist in the same unit of work,
ensuring deleted objects are not referred after commit,
ensures that objects from the parent cache are not referred in the unit of work cache.
|
void |
performRemove(java.lang.Object toBeDeleted,
java.util.Map visitedObjects)
INTERNAL:
This method will perform a delete operation on the provided objects pre-determining
the objects that will be deleted by a commit of the UnitOfWork including privately
owned objects.
|
void |
performRemovePrivateOwnedObjectFromChangeSet(java.lang.Object toBeRemoved,
java.util.Map visitedObjects)
INTERNAL:
Cascade remove the private owned object from the owned UnitOfWorkChangeSet
|
void |
printRegisteredObjects()
PUBLIC:
Print the objects in the unit of work.
|
java.lang.Object |
processDeleteObjectQuery(DeleteObjectQuery deleteQuery)
INTERNAL:
This method is used to process delete queries that pass through the unitOfWork
It is extracted out of the internalExecuteQuery method to reduce duplication
|
java.util.Vector |
registerAllObjects(java.util.Collection domainObjects)
PUBLIC:
Register the objects with the unit of work.
|
java.util.Vector |
registerAllObjects(java.util.Vector domainObjects)
PUBLIC:
Register the objects with the unit of work.
|
java.lang.Object |
registerExistingObject(java.lang.Object existingObject)
ADVANCED:
Register the existing object with the unit of work.
|
java.lang.Object |
registerExistingObject(java.lang.Object existingObject,
boolean isFromSharedCache)
ADVANCED:
Register the existing object with the unit of work.
|
java.lang.Object |
registerExistingObject(java.lang.Object objectToRegister,
ClassDescriptor descriptor,
java.lang.Object queryPrimaryKey,
boolean isFromSharedCache)
INTERNAL:
Register the existing object with the unit of work.
|
java.lang.Object |
registerNewContainerBean(java.lang.Object newObject)
INTERNAL:
Register the new container bean with the unit of work.
|
java.lang.Object |
registerNewContainerBeanForCMP(java.lang.Object newObject)
INTERNAL:
Register the new Bean with the unit of work.
|
java.lang.Object |
registerNewObject(java.lang.Object newObject)
ADVANCED:
Register the new object with the unit of work.
|
void |
registerNewObjectForPersist(java.lang.Object newObject,
java.util.Map visitedObjects)
INTERNAL:
Register the new object with the unit of work.
|
java.lang.Object |
registerObject(java.lang.Object object)
PUBLIC:
Register the object with the unit of work.
|
void |
registerOriginalNewObjectFromNestedUnitOfWork(java.lang.Object originalObject,
java.lang.Object backupClone,
java.lang.Object newInstance,
ClassDescriptor descriptor)
INTERNAL:
Register a new object from a nested unit of work into its parent.
|
void |
registerWithTransactionIfRequired()
INTERNAL:
Register this UnitOfWork against an external transaction controller
|
void |
release()
PUBLIC:
Release the unit of work.
|
void |
releaseJTSConnection()
INTERNAL:
Called in the end of beforeCompletion of external transaction synchronization listener.
|
void |
releaseReadConnection(Accessor connection)
INTERNAL:
Release the read connection to the read connection pool.
|
void |
releaseWriteLocks()
INTERNAL:
Release the unit of work cache write locks, if acquired.
|
void |
removeAllReadOnlyClasses()
PUBLIC:
Empties the set of read-only classes.
|
void |
removeForceUpdateToVersionField(java.lang.Object lockObject)
ADVANCED:
Remove optimistic read lock from the object
See forceUpdateToVersionField(Object)
|
void |
removePrivateOwnedObject(DatabaseMapping mapping,
java.lang.Object privateOwnedObject)
INTERNAL:
Remove a privately owned object from the privateOwnedObjects Map.
|
void |
removeReadOnlyClass(java.lang.Class theClass)
PUBLIC:
Removes a Class from the receiver's set of read-only classes.
|
void |
resumeUnitOfWork()
INTERNAL:
Resume the unit of work state after a flush, or resume operation.
|
java.lang.Object |
retryQuery(DatabaseQuery query,
AbstractRecord row,
DatabaseException databaseException,
int retryCount,
AbstractSession executionSession)
INTERNAL:
A query execution failed due to an invalid query.
|
void |
revertAndResume()
PUBLIC:
Revert all changes made to any registered object.
|
java.lang.Object |
revertObject(java.lang.Object clone)
PUBLIC:
Revert the object's attributes from the parent.
|
java.lang.Object |
revertObject(java.lang.Object clone,
int cascadeDepth)
INTERNAL:
Revert the object's attributes from the parent.
|
void |
rollbackTransaction()
INTERNAL:
This is internal to the uow, transactions should not be used explicitly in a uow.
|
java.util.Map<java.lang.Object,java.lang.Object> |
scanForConformingInstances(Expression selectionCriteria,
java.lang.Class referenceClass,
AbstractRecord arguments,
ObjectLevelReadQuery query)
INTERNAL:
Scans the UnitOfWork identity map for conforming instances.
|
void |
setBatchQueries(java.util.Map<ReadQuery,ReadQuery> batchQueries)
INTERNAL:
When in transaction batch read objects must use query local
to the unit of work.
|
void |
setCommitOrder(UnitOfWork.CommitOrderType order)
ADVANCED:
Set the commit order.
|
void |
setDead()
INTERNAL:
set UoW lifecycle state variable to DEATH
|
void |
setMergeManager(MergeManager mergeManager)
INTERNAL:
A reference to the last used merge manager.
|
void |
setObjectsDeletedDuringCommit(java.util.Map deletedObjects)
INTERNAL:
Set the objects that have been deleted.
|
void |
setParent(AbstractSession parent)
INTERNAL:
Set the parent.
|
void |
setPendingMerge()
INTERNAL:
set UoW lifecycle state variable to PENDING_MERGE
|
void |
setPreDeleteComplete(boolean preDeleteComplete) |
void |
setReadOnlyClasses(java.util.List<java.lang.Class> classes)
INTERNAL:
Gives a new set of read-only classes to the receiver.
|
void |
setResumeUnitOfWorkOnTransactionCompletion(boolean resumeUnitOfWork)
INTERNAL:
Set if this UnitofWork should be resumed after the end of the transaction
Used when UnitOfWork is synchronized with external transaction control
|
void |
setShouldCascadeCloneToJoinedRelationship(boolean shouldCascadeCloneToJoinedRelationship)
INTERNAL:
True if the value holder for the joined attribute should be triggered.
|
void |
setShouldDiscoverNewObjects(boolean shouldDiscoverNewObjects)
INTERNAL:
Set if this UnitofWork should discover new objects on commit.
|
void |
setShouldNewObjectsBeCached(boolean shouldNewObjectsBeCached)
ADVANCED:
By default new objects are not cached until the exist on the database.
|
void |
setShouldOrderUpdates(boolean shouldOrderUpdates)
ADVANCED:
Set updates should be ordered by primary key to avoid possible database deadlocks.
|
void |
setShouldPerformDeletesFirst(boolean shouldPerformDeletesFirst)
ADVANCED:
By default deletes are performed last in a unit of work.
|
void |
setShouldThrowConformExceptions(int shouldThrowExceptions)
ADVANCED:
Conforming queries can be set to provide different levels of detail about the
exceptions they encounter
There are two levels:
DO_NOT_THROW_CONFORM_EXCEPTIONS = 0;
THROW_ALL_CONFORM_EXCEPTIONS = 1;
|
void |
setShouldValidateExistence(boolean shouldValidateExistence)
Set the default to determine if does-exist should be performed on persist.
|
static void |
setSmartMerge(boolean option)
INTERNAL:
Set smart merge flag.
|
void |
setSynchronized(boolean synched)
INTERNAL:
Set isSynchronized flag to indicate that this session is a synchronized unit of work.
|
void |
setTransaction(java.lang.Object transaction)
INTERNAL:
PERF: Set the associated external transaction.
|
void |
setUnitOfWorkChangeSet(UnitOfWorkChangeSet unitOfWorkChangeSet)
INTERNAL:
Sets the current UnitOfWork change set to be the one passed in.
|
void |
setValidationLevel(int validationLevel)
ADVANCED:
The unit of work performs validations such as,
ensuring multiple copies of the same object don't exist in the same unit of work,
ensuring deleted objects are not referred after commit,
ensures that objects from the parent cache are not referred in the unit of work cache.
|
void |
setWasNonObjectLevelModifyQueryExecuted(boolean wasNonObjectLevelModifyQueryExecuted)
INTERNAL:
True if either DataModifyQuery or ModifyAllQuery was executed.
|
void |
setWasTransactionBegunPrematurely(boolean wasTransactionBegunPrematurely)
INTERNAL:
Set a flag in the root UOW to indicate that a pess.
|
java.lang.Object |
shallowMergeClone(java.lang.Object rmiClone)
PUBLIC:
Merge the attributes of the clone into the unit of work copy.
|
java.lang.Object |
shallowRevertObject(java.lang.Object clone)
PUBLIC:
Revert the object's attributes from the parent.
|
void |
shallowUnregisterObject(java.lang.Object clone)
ADVANCED:
Unregister the object with the unit of work.
|
boolean |
shouldCascadeCloneToJoinedRelationship()
INTERNAL:
True if the value holder for the joined attribute should be triggered.
|
boolean |
shouldClearForCloseOnRelease()
INTERNAL:
Indicates whether clearForClose method should be called by release method.
|
boolean |
shouldDiscoverNewObjects()
INTERNAL:
Set if this UnitofWork should discover new objects on commit.
|
boolean |
shouldForceReadFromDB(ObjectBuildingQuery query,
java.lang.Object primaryKey)
INTERNAL:
Calculate whether we should read directly from the database to the UOW.
|
boolean |
shouldNewObjectsBeCached()
ADVANCED:
By default new objects are not cached until the exist on the database.
|
boolean |
shouldOrderUpdates()
ADVANCED:
Return if updates should be ordered by primary key to avoid possible database deadlocks.
|
boolean |
shouldPerformDeletesFirst()
ADVANCED:
By default all objects are inserted and updated in the database before
any object is deleted.
|
boolean |
shouldPerformFullValidation()
ADVANCED:
The unit of work performs validations such as,
ensuring multiple copies of the same object don't exist in the same unit of work,
ensuring deleted objects are not referred after commit,
ensures that objects from the parent cache are not refered in the unit of work cache.
|
boolean |
shouldPerformNoValidation()
ADVANCED:
The unit of work performs validations such as,
ensuring multiple copies of the same object don't exist in the same unit of work,
ensuring deleted objects are not referred after commit,
ensures that objects from the parent cache are not refered in the unit of work cache.
|
boolean |
shouldPerformPartialValidation()
ADVANCED:
The unit of work performs validations such as,
ensuring multiple copies of the same object don't exist in the same unit of work,
ensuring deleted objects are not refered after commit,
ensures that objects from the parent cache are not refered in the unit of work cache.
|
boolean |
shouldReadFromDB()
INTERNAL:
Indicates whether readObject should return the object read from the db
in case there is no object in uow cache (as opposed to fetching the object from
parent's cache).
|
boolean |
shouldResumeUnitOfWorkOnTransactionCompletion()
INTERNAL:
Returns true if this UnitofWork should be resumed after the end of the transaction
Used when UnitOfWork is synchronized with external transaction control
|
boolean |
shouldStoreBypassCache()
INTERNAL:
This is a JPA setting that is off by default in regular EclipseLink.
|
boolean |
shouldValidateExistence()
Return the default to determine if does-exist should be performed on persist.
|
void |
storeDeferredModifyAllQuery(DatabaseQuery query,
AbstractRecord translationRow)
INTERNAL:
Store the deferred UpdateAllQuery's from the UoW in the list for execution.
|
void |
storeModifyAllQuery(DatabaseQuery query)
INTERNAL:
Store the ModifyAllQuery's from the UoW in the list.
|
void |
synchronizeAndResume()
INTERNAL
Synchronize the clones and update their backup copies.
|
void |
unregisterObject(java.lang.Object clone)
PUBLIC:
Unregister the object with the unit of work.
|
void |
unregisterObject(java.lang.Object clone,
int cascadeDepth)
INTERNAL:
Unregister the object with the unit of work.
|
void |
unregisterObject(java.lang.Object clone,
int cascadeDepth,
boolean forDetach)
INTERNAL:
Unregister the object with the unit of work.
|
void |
updateChangeTrackersIfRequired(java.lang.Object objectToWrite,
ObjectChangeSet changeSetToWrite,
UnitOfWorkImpl uow,
ClassDescriptor descriptor)
INTERNAL:
This method is used internally to update the tracked objects if required
|
void |
validateObjectSpace()
ADVANCED:
This can be used to help debugging an object-space corruption.
|
boolean |
verifyMutexThreadIntegrityBeforeRelease()
INTERNAL:
272022: Avoid releasing locks on the wrong server thread.
|
boolean |
wasDeleted(java.lang.Object original)
INTERNAL:
Return if the object was deleted previously (in a flush).
|
boolean |
wasNonObjectLevelModifyQueryExecuted()
INTERNAL:
True if either DataModifyQuery or ModifyAllQuery was executed.
|
boolean |
wasTransactionBegunPrematurely()
INTERNAL:
Indicates if a transaction was begun by a pessimistic locking or non-selecting query.
|
void |
writeChanges()
ADVANCED: Writes all changes now before commit().
|
void |
writesCompleted()
INTERNAL:
This method notifies the accessor that a particular sets of writes has
completed.
|
acquireNonSynchronizedUnitOfWork, acquireNonSynchronizedUnitOfWork, acquireRepeatableWriteUnitOfWork, acquireUnitOfWork, addAlias, addJPAQuery, addJPATablePerTenantQuery, addMultitenantContextProperty, addQuery, addQuery, addStaticMetamodelClass, basicExecuteCall, beginExternalTransaction, checkAndRefreshInvalidObject, cleanUpEntityListenerInjectionManager, clearDescriptors, clearIntegrityChecker, clearLastDescriptorAccessed, clearProfile, clone, commitExternalTransaction, compareObjects, compareObjectsDontMatch, config, containsQuery, copy, copy, copyDescriptorNamedQueries, copyDescriptorsFromProject, copyInternal, copyObject, copyObject, createEntityListenerInjectionManager, createProtectedInstanceFromCachedData, deferEvent, deleteAllObjects, 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, getClassDescriptor, getClassDescriptor, getClassDescriptorForAlias, getCommandManager, getDatasourceLogin, getDatasourcePlatform, getDefaultReferenceMode, getDescriptor, getDescriptor, getDescriptorForAlias, getDescriptors, getEntityListenerInjectionManager, getEventManager, getExceptionHandler, getExceptionHandlerClass, getExternalTransactionController, getId, getIdentityMapAccessor, getIdentityMapAccessorInstance, getIntegrityChecker, getJPAQueries, getJPATablePerTenantQueries, getLoader, getLog, getLogin, getLogLevel, getLogLevel, getLogSessionString, getMappedSuperclass, getMultitenantContextProperties, getName, getNextQueryId, getNextSequenceNumberValue, getNumberOfActiveUnitsOfWork, getParentIdentityMapSession, getParentIdentityMapSession, getPartitioningPolicy, getPessimisticLockTimeoutDefault, getPlatform, getProfiler, getProject, getProperties, getQueries, getQuery, getQuery, getQueryBuilder, getQueryTimeoutDefault, 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, keyFromObject, load, load, log, log, log, log, log, log, log, log, log, log, logMessage, logMessage, logThrowable, postAcquireConnection, prepareDatabaseQuery, preReleaseConnection, priviledgedExecuteNonSelectingCall, priviledgedExecuteSelectingCall, processCommand, processJPAQueries, readAllObjects, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, readObject, refreshAndLockObject, refreshAndLockObject, refreshObject, registerFinalizer, releaseConnectionAfterCall, releaseUnitOfWork, removeProperty, removeQuery, removeQuery, retrieveCacheKey, retryTransaction, setAccessor, setBroker, setCommandManager, setCommitManager, setDatasourceLogin, setDefaultReferenceMode, setEntityListenerInjectionManager, setEventManager, setExceptionHandler, setExternalTransactionController, setIntegrityChecker, setIsConcurrent, setIsFinalizersEnabled, setIsInBroker, setIsInProfile, setJPAQueriesProcessed, setLog, setLoggingOff, setLogin, setLogin, setLogLevel, setName, setPartitioningPolicy, setPessimisticLockTimeoutDefault, setProfiler, setProject, setProperties, setProperty, setQueries, setQueryBuilder, setQueryTimeoutDefault, setRefreshMetadataListener, setSerializer, setSessionLog, setShouldOptimizeResultSetAccess, setShouldPropagateChanges, setTolerateInvalidJPQL, setWasJTSTransactionInternallyStarted, severe, shouldDisplayData, shouldLog, shouldLogMessages, shouldLogMessages, shouldOptimizeResultSetAccess, shouldPropagateChanges, shouldTolerateInvalidJPQL, startOperationProfile, startOperationProfile, toString, unwrapObject, updateObject, updateProfile, updateTablePerTenantDescriptors, validateCache, validateQuery, verifyDelete, warning, wasJTSTransactionInternallyStarted, wrapObject, writeObject
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
deleteAllObjects, deleteObject, isClassReadOnly, refreshAndLockObject, refreshAndLockObject
acquireUnitOfWork, addJPAQuery, addQuery, clearIntegrityChecker, clearProfile, containsQuery, copy, copy, copyObject, copyObject, 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, keyFromObject, log, logMessage, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, refreshObject, removeProperty, removeQuery, setDefaultReferenceMode, setExceptionHandler, setExternalTransactionController, setIntegrityChecker, setIsFinalizersEnabled, setLog, setLogLevel, setName, setPartitioningPolicy, setProfiler, setProperty, setQueryTimeoutDefault, setSerializer, setSessionLog, shouldLog, shouldLogMessages, validateCache
public static final int None
public static final int Partial
public static final int Full
public static final int Birth
public static final int CommitPending
public static final int CommitTransactionPending
public static final int WriteChangesFailed
public static final int MergePending
public static final int Death
public static final int AfterExternalTransactionRolledBack
public static final int DO_NOT_THROW_CONFORM_EXCEPTIONS
public static final int THROW_ALL_CONFORM_EXCEPTIONS
public static final java.lang.String LOCK_QUERIES_PROPERTY
public static final java.lang.String ReadLockOnly
public static final java.lang.String ReadLockUpdateVersion
public UnitOfWorkImpl()
public UnitOfWorkImpl(AbstractSession parent, ReferenceMode referenceMode)
public Session acquireHistoricalSession(AsOfClause clause) throws ValidationException
acquireHistoricalSession
in interface Session
acquireHistoricalSession
in class AbstractSession
clause
- Represents a valid snap shot time.ValidationException
- if this
not a ClientSession, plain Session, or SessionBroker.AsOfClause
,
Expression.asOf(org.eclipse.persistence.history.AsOfClause)
,
ObjectLevelReadQuery.setAsOfClause(org.eclipse.persistence.history.AsOfClause)
,
HistoryPolicy
public UnitOfWorkImpl acquireUnitOfWork()
acquireUnitOfWork
in interface Session
acquireUnitOfWork
in class AbstractSession
UnitOfWorkImpl
public void addDeletedPrivateOwnedObjects(DatabaseMapping mapping, java.lang.Object object)
public void addNewAggregate(java.lang.Object originalObject)
public void addObjectDeletedDuringCommit(java.lang.Object object, ClassDescriptor descriptor)
public void addReadOnlyClass(java.lang.Class theClass) throws ValidationException
addReadOnlyClass
in interface UnitOfWork
ValidationException
public void addReadOnlyClasses(java.util.Collection classes)
addReadOnlyClasses
in interface UnitOfWork
public void addRemovedObject(java.lang.Object orignal)
public void assignSequenceNumber(java.lang.Object object) throws DatabaseException
assignSequenceNumber
in interface UnitOfWork
DatabaseException
public java.lang.Object assignSequenceNumber(java.lang.Object object, ClassDescriptor descriptor) throws DatabaseException
DatabaseException
public void assignSequenceNumbers() throws DatabaseException
assignSequenceNumbers
in interface UnitOfWork
DatabaseException
public void beginEarlyTransaction() throws DatabaseException
beginEarlyTransaction
in interface UnitOfWork
DatabaseException
commit()
,
release()
public void beginTransaction() throws DatabaseException
beginTransaction
in class AbstractSession
DatabaseException
- if the database connection is lost or the begin is rejected.AbstractSession.isInTransaction()
public java.lang.Object buildOriginal(java.lang.Object workingClone)
public UnitOfWorkChangeSet calculateChanges(java.util.Map registeredObjects, UnitOfWorkChangeSet changeSet, boolean assignSequences, boolean shouldCloneMap)
This calculates changes in two passes, first on registered objects, second it discovers unregistered new objects on only those objects that changed, and calculates their changes. This also assigns sequence numbers to new objects.
public boolean checkForUnregisteredExistingObject(java.lang.Object object)
public java.lang.Object checkExistence(java.lang.Object object)
public java.lang.Object checkIfAlreadyRegistered(java.lang.Object object, ClassDescriptor descriptor)
public boolean isConsideredInvalid(java.lang.Object object, CacheKey cacheKey, ClassDescriptor descriptor)
isConsideredInvalid
in class AbstractSession
public java.lang.Object cloneAndRegisterObject(java.lang.Object original, CacheKey parentCacheKey, ClassDescriptor descriptor)
public java.lang.Object cloneAndRegisterObject(java.lang.Object original, CacheKey parentCacheKey, CacheKey unitOfWorkCacheKey, ClassDescriptor descriptor)
public java.util.Map collectAndPrepareObjectsForNestedMerge()
public void commit() throws DatabaseException, OptimisticLockException
commit
in interface UnitOfWork
DatabaseException
OptimisticLockException
commitAndResumeOnFailure()
,
commitAndResume()
,
release()
public void commitAndResume() throws DatabaseException, OptimisticLockException
commitAndResume
in interface UnitOfWork
DatabaseException
OptimisticLockException
commitAndResumeOnFailure()
,
commit()
,
release()
public void commitAndResumeWithPreBuiltChangeSet(UnitOfWorkChangeSet uowChangeSet) throws DatabaseException, OptimisticLockException
public void commitAndResumeOnFailure() throws DatabaseException, OptimisticLockException
commitAndResumeOnFailure
in interface UnitOfWork
DatabaseException
OptimisticLockException
commit()
,
release()
public void commitRootUnitOfWork() throws DatabaseException, OptimisticLockException
public void commitRootUnitOfWorkWithPreBuiltChangeSet(UnitOfWorkChangeSet uowChangeSet) throws DatabaseException, OptimisticLockException
public void commitTransaction() throws DatabaseException
commitTransaction
in class AbstractSession
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.public void commitTransactionAfterWriteChanges()
public void releaseWriteLocks()
public java.util.Vector copyReadOnlyClasses()
copyReadOnlyClasses
in class AbstractSession
public java.lang.Object deepMergeClone(java.lang.Object rmiClone)
deepMergeClone
in interface UnitOfWork
mergeClone(Object)
,
shallowMergeClone(Object)
public java.lang.Object deepRevertObject(java.lang.Object clone)
deepRevertObject
in interface UnitOfWork
revertObject(Object)
,
shallowRevertObject(Object)
public void deepUnregisterObject(java.lang.Object clone)
deepUnregisterObject
in interface UnitOfWork
public void discoverUnregisteredNewObjects(java.util.Map clones, java.util.Map knownNewObjects, java.util.Map unregisteredExistingObjects, java.util.Map visitedObjects)
public void dontPerformValidation()
dontPerformValidation
in interface UnitOfWork
public java.lang.Object executeCall(Call call, AbstractRecord translationRow, DatabaseQuery query) throws DatabaseException
executeCall
in class AbstractSession
DatabaseException
public void forceUpdateToVersionField(java.lang.Object lockObject, boolean shouldModifyVersionField)
forceUpdateToVersionField
in interface UnitOfWork
public Accessor getAccessor()
getAccessor
in class AbstractSession
public java.util.Collection<Accessor> getAccessors()
getAccessors
in class AbstractSession
public CommitManager getCommitManager()
getCommitManager
in class AbstractSession
public java.util.Collection<Accessor> getAccessors(Call call, AbstractRecord translationRow, DatabaseQuery query)
getAccessors
in class AbstractSession
public UnitOfWork getActiveUnitOfWork()
getActiveUnitOfWork
in interface Session
getActiveUnitOfWork
in class AbstractSession
public java.util.Vector getAllFromNewObjects(Expression selectionCriteria, java.lang.Class theClass, AbstractRecord translationRow, int valueHolderPolicy)
public java.lang.Object getBackupClone(java.lang.Object clone) throws QueryException
QueryException
public java.lang.Object getBackupClone(java.lang.Object clone, ClassDescriptor descriptor) throws QueryException
QueryException
public java.lang.Object getBackupCloneForCommit(java.lang.Object clone, ClassDescriptor descriptor)
public java.lang.Object getBackupCloneForCommit(java.lang.Object clone)
public UnitOfWorkChangeSet getCurrentChanges()
getCurrentChanges
in interface UnitOfWork
public AbstractSession getParentIdentityMapSession(ClassDescriptor descriptor, boolean canReturnSelf, boolean terminalOnly)
getParentIdentityMapSession
in class AbstractSession
canReturnSelf
- true when method calls itself. If the path
starting at this
is acceptable. Sometimes true if want to
move to the first valid session, i.e. executing on ClientSession when really
should be on ServerSession.terminalOnly
- return the last session in the chain where the Enitity is stored.public AbstractSession getExecutionSession(DatabaseQuery query)
Since the execution session also knows the correct datasource platform to execute on, it is often used in the mappings where the platform is needed for type conversion, or where calls are translated.
Is also the session with the accessor. Will return a ClientSession if it is in transaction and has a write connection.
getExecutionSession
in class AbstractSession
query
- may store session name or reference class for brokers casepublic java.util.Map getCloneMapping()
public boolean hasCloneMapping()
public java.util.Map getCloneToOriginals()
public java.util.Map getContainerBeans()
public boolean hasContainerBeans()
public java.util.Set<java.lang.Object> getCascadeDeleteObjects()
public boolean hasCascadeDeleteObjects()
public boolean hasUnregisteredNewObjects()
public boolean hasNewObjects()
public UnitOfWorkImpl getContainerUnitOfWork()
public java.util.Vector getDefaultReadOnlyClasses()
getDefaultReadOnlyClasses
in class AbstractSession
org.eclipse.persistence.sessions.Project#setDefaultReadOnlyClasses(Vector)
public java.util.Map getDeletedObjects()
public boolean hasDeletedObjects()
public int getLifecycle()
public MergeManager getMergeManager()
public java.util.Map getNewAggregates()
public java.util.Map getNewObjectsCloneToOriginal()
public java.util.Map getNewObjectsCloneToMergeOriginal()
public java.util.Map getNewObjectsInParentOriginalToClone()
public boolean hasPrivateOwnedObjects()
public boolean hasOptimisticReadLockObjects()
public java.util.Map getNewObjectsOriginalToClone()
public Sequencing getSequencing()
getSequencing
in class AbstractSession
public ServerPlatform getServerPlatform()
getServerPlatform
in interface Session
getServerPlatform
in class AbstractSession
public java.lang.String getSessionTypeString()
Override to hide from the user when they are using an internal subclass of a known class.
A user does not need to know that their UnitOfWork is a non-deferred UnitOfWork, or that their ClientSession is an IsolatedClientSession.
getSessionTypeString
in class AbstractSession
public void afterExternalTransactionRollback()
public void releaseJTSConnection()
releaseJTSConnection
in class AbstractSession
public java.lang.Object getObjectFromNewObjects(java.lang.Class theClass, java.lang.Object selectionKey)
public java.lang.Object getObjectFromNewObjects(Expression selectionCriteria, java.lang.Class theClass, AbstractRecord translationRow, int valueHolderPolicy)
public java.util.Map getObjectsDeletedDuringCommit()
public java.util.Map getOptimisticReadLockObjects()
public java.lang.Object getOriginalVersionOfNewObject(java.lang.Object workingClone)
public java.lang.Object getOriginalVersionOfObject(java.lang.Object workingClone)
getOriginalVersionOfObject
in interface UnitOfWork
public java.lang.Object getOriginalVersionOfObjectOrNull(java.lang.Object workingClone, ObjectChangeSet changeSet, ClassDescriptor descriptor, AbstractSession targetSession)
public java.lang.Object getOriginalVersionOfObjectOrNull(java.lang.Object workingClone, ClassDescriptor descriptor)
public AbstractSession getParent()
getParent
in interface UnitOfWork
getParent
in class AbstractSession
public java.lang.Object getProperty(java.lang.String name)
getProperty
in interface Session
getProperty
in class AbstractSession
public Platform getPlatform(java.lang.Class domainClass)
getPlatform
in class AbstractSession
public int getShouldThrowConformExceptions()
public DatabaseQuery getQuery(java.lang.String name, java.util.Vector arguments)
getQuery
in class AbstractSession
AbstractSession.getQuery(String)
public DatabaseQuery getQuery(java.lang.String name)
getQuery
in interface Session
getQuery
in class AbstractSession
public java.util.Set getReadOnlyClasses()
getReadOnlyClasses
in interface UnitOfWork
public int getState()
public java.lang.Object getTransaction()
public void setTransaction(java.lang.Object transaction)
public UnitOfWorkChangeSet getUnitOfWorkChangeSet()
getUnitOfWorkChangeSet
in interface UnitOfWork
public java.util.Map getUnregisteredExistingObjects()
public int getValidationLevel()
getValidationLevel
in interface UnitOfWork
public boolean hasChanges()
hasChanges
in interface UnitOfWork
public void initializeIdentityMapAccessor()
initializeIdentityMapAccessor
in class AbstractSession
public java.lang.Object internalExecuteQuery(DatabaseQuery query, AbstractRecord databaseRow) throws DatabaseException, QueryException
internalExecuteQuery
in class AbstractSession
DatabaseException
QueryException
public java.lang.Object internalRegisterObject(java.lang.Object object, ClassDescriptor descriptor, boolean isShallowClone)
public boolean isActive()
isActive
in interface UnitOfWork
public boolean isClassReadOnly(java.lang.Class theClass, ClassDescriptor descriptor)
isClassReadOnly
in class AbstractSession
public boolean isCloneNewObjectFromParent(java.lang.Object clone)
public boolean isCloneNewObject(java.lang.Object clone)
public boolean isCommitPending()
public boolean isDead()
public boolean isInTransaction()
isInTransaction
in class AbstractSession
public boolean isMergePending()
public boolean isAfterWriteChangesButBeforeCommit()
public boolean isNestedUnitOfWork()
isNestedUnitOfWork
in interface UnitOfWork
public boolean isNewObjectInParent(java.lang.Object clone)
public boolean isObjectDeleted(java.lang.Object object)
public boolean isObjectNew(java.lang.Object clone)
public boolean isUnregisteredExistingObject(java.lang.Object object)
public boolean isObjectRegistered(java.lang.Object clone)
isObjectRegistered
in interface UnitOfWork
public boolean isOriginalNewObject(java.lang.Object original)
public static boolean isSmartMerge()
public void issueSQLbeforeCompletion()
public void issueSQLbeforeCompletion(boolean commitTransaction)
public boolean isUnitOfWork()
isUnitOfWork
in interface Session
isUnitOfWork
in class AbstractSession
public boolean isUnregisteredNewObjectInParent(java.lang.Object originalObject)
public java.lang.Object mergeClone(java.lang.Object rmiClone)
mergeClone
in interface UnitOfWork
shallowMergeClone(Object)
,
deepMergeClone(Object)
public java.lang.Object mergeClone(java.lang.Object rmiClone, int cascadeDepth, boolean forRefresh)
public void mergeClonesAfterCompletion()
public java.lang.Object mergeCloneWithReferences(java.lang.Object rmiClone)
mergeCloneWithReferences
in interface UnitOfWork
shallowMergeClone(Object)
,
deepMergeClone(Object)
public java.lang.Object mergeCloneWithReferences(java.lang.Object rmiClone, int cascadePolicy)
shallowMergeClone(Object)
,
deepMergeClone(Object)
public java.lang.Object mergeCloneWithReferences(java.lang.Object rmiClone, int cascadePolicy, boolean forceCascade)
shallowMergeClone(Object)
,
deepMergeClone(Object)
public java.lang.Object mergeCloneWithReferences(java.lang.Object rmiClone, MergeManager manager)
shallowMergeClone(Object)
,
deepMergeClone(Object)
public java.lang.Object newInstance(java.lang.Class theClass)
newInstance
in interface UnitOfWork
public void performRemove(java.lang.Object toBeDeleted, java.util.Map visitedObjects)
public void performRemovePrivateOwnedObjectFromChangeSet(java.lang.Object toBeRemoved, java.util.Map visitedObjects)
public void performFullValidation()
performFullValidation
in interface UnitOfWork
public void performPartialValidation()
performPartialValidation
in interface UnitOfWork
public void printRegisteredObjects()
printRegisteredObjects
in interface UnitOfWork
public java.lang.Object processDeleteObjectQuery(DeleteObjectQuery deleteQuery)
public java.util.Vector registerAllObjects(java.util.Collection domainObjects)
registerAllObjects
in interface UnitOfWork
public java.util.Vector registerAllObjects(java.util.Vector domainObjects) throws DatabaseException, OptimisticLockException
DatabaseException
OptimisticLockException
public java.lang.Object registerExistingObject(java.lang.Object existingObject)
registerExistingObject
in interface UnitOfWork
public java.lang.Object registerExistingObject(java.lang.Object existingObject, boolean isFromSharedCache)
public java.lang.Object registerExistingObject(java.lang.Object objectToRegister, ClassDescriptor descriptor, java.lang.Object queryPrimaryKey, boolean isFromSharedCache)
public java.lang.Object registerNewContainerBean(java.lang.Object newObject)
registerObject(Object)
public java.lang.Object registerNewContainerBeanForCMP(java.lang.Object newObject)
public java.lang.Object registerNewObject(java.lang.Object newObject)
registerNewObject
in interface UnitOfWork
registerObject(Object)
public void discoverAndPersistUnregisteredNewObjects(java.lang.Object object, boolean cascadePersist, java.util.Map newObjects, java.util.Map unregisteredExistingObjects, java.util.Map visitedObjects, java.util.Set cascadeErrors)
newObjects
- any new objects found must be added to this collection.cascadePersist
- determines if this call is cascading from a cascadePersist mapping or not.public void registerNewObjectForPersist(java.lang.Object newObject, java.util.Map visitedObjects)
registerObject(Object)
public boolean wasDeleted(java.lang.Object original)
public java.lang.Object registerObject(java.lang.Object object)
registerObject
in interface UnitOfWork
public void registerOriginalNewObjectFromNestedUnitOfWork(java.lang.Object originalObject, java.lang.Object backupClone, java.lang.Object newInstance, ClassDescriptor descriptor)
public void registerWithTransactionIfRequired()
public void release()
release
in interface Session
release
in interface UnitOfWork
release
in class AbstractSession
commit()
public void removeAllReadOnlyClasses() throws ValidationException
removeAllReadOnlyClasses
in interface UnitOfWork
ValidationException
public void removeForceUpdateToVersionField(java.lang.Object lockObject)
removeForceUpdateToVersionField
in interface UnitOfWork
public void removePrivateOwnedObject(DatabaseMapping mapping, java.lang.Object privateOwnedObject)
public void removeReadOnlyClass(java.lang.Class theClass) throws ValidationException
removeReadOnlyClass
in interface UnitOfWork
ValidationException
public void revertAndResume()
revertAndResume
in interface UnitOfWork
commitAndResume()
,
release()
public java.lang.Object revertObject(java.lang.Object clone)
revertObject
in interface UnitOfWork
shallowRevertObject(Object)
,
deepRevertObject(Object)
public java.lang.Object revertObject(java.lang.Object clone, int cascadeDepth)
public void rollbackTransaction() throws DatabaseException
rollbackTransaction
in class AbstractSession
DatabaseException
- if the database connection is lost or the rollback fails.public java.util.Map<java.lang.Object,java.lang.Object> scanForConformingInstances(Expression selectionCriteria, java.lang.Class referenceClass, AbstractRecord arguments, ObjectLevelReadQuery query)
Later this method can be made recursive to check all parent units of work also.
selectionCriteria
- must be cloned and specially prepared for conformingpublic void setDead()
public void setMergeManager(MergeManager mergeManager)
public void setObjectsDeletedDuringCommit(java.util.Map deletedObjects)
public void setParent(AbstractSession parent)
public void setPendingMerge()
public void setPreDeleteComplete(boolean preDeleteComplete)
preDeleteComplete
- the preDeleteComplete to setpublic void setReadOnlyClasses(java.util.List<java.lang.Class> classes)
public void setResumeUnitOfWorkOnTransactionCompletion(boolean resumeUnitOfWork)
public boolean shouldDiscoverNewObjects()
public void setShouldDiscoverNewObjects(boolean shouldDiscoverNewObjects)
public void setShouldCascadeCloneToJoinedRelationship(boolean shouldCascadeCloneToJoinedRelationship)
public boolean shouldForceReadFromDB(ObjectBuildingQuery query, java.lang.Object primaryKey)
RepeatableWriteUnitOfWork
public void setShouldNewObjectsBeCached(boolean shouldNewObjectsBeCached)
setShouldNewObjectsBeCached
in interface UnitOfWork
public void setShouldPerformDeletesFirst(boolean shouldPerformDeletesFirst)
setShouldPerformDeletesFirst
in interface UnitOfWork
public void setShouldThrowConformExceptions(int shouldThrowExceptions)
setShouldThrowConformExceptions
in interface UnitOfWork
public static void setSmartMerge(boolean option)
public void setSynchronized(boolean synched)
setSynchronized
in class AbstractSession
public void setUnitOfWorkChangeSet(UnitOfWorkChangeSet unitOfWorkChangeSet)
public void setValidationLevel(int validationLevel)
setValidationLevel
in interface UnitOfWork
public void setWasTransactionBegunPrematurely(boolean wasTransactionBegunPrematurely)
public java.lang.Object shallowMergeClone(java.lang.Object rmiClone)
shallowMergeClone
in interface UnitOfWork
mergeClone(Object)
,
deepMergeClone(Object)
public java.lang.Object shallowRevertObject(java.lang.Object clone)
shallowRevertObject
in interface UnitOfWork
revertObject(Object)
,
deepRevertObject(Object)
public void shallowUnregisterObject(java.lang.Object clone)
shallowUnregisterObject
in interface UnitOfWork
public boolean shouldCascadeCloneToJoinedRelationship()
public boolean shouldNewObjectsBeCached()
shouldNewObjectsBeCached
in interface UnitOfWork
public boolean shouldValidateExistence()
public void setShouldValidateExistence(boolean shouldValidateExistence)
public boolean shouldPerformDeletesFirst()
shouldPerformDeletesFirst
in interface UnitOfWork
public boolean shouldPerformFullValidation()
shouldPerformFullValidation
in interface UnitOfWork
public boolean shouldPerformNoValidation()
shouldPerformNoValidation
in interface UnitOfWork
public boolean shouldPerformPartialValidation()
shouldPerformPartialValidation
in interface UnitOfWork
public boolean shouldResumeUnitOfWorkOnTransactionCompletion()
public boolean shouldStoreBypassCache()
RepeatableWriteUnitOfWork.
public void storeModifyAllQuery(DatabaseQuery query)
public void storeDeferredModifyAllQuery(DatabaseQuery query, AbstractRecord translationRow)
public void synchronizeAndResume()
public void resumeUnitOfWork()
public void unregisterObject(java.lang.Object clone)
unregisterObject
in interface UnitOfWork
public void unregisterObject(java.lang.Object clone, int cascadeDepth)
public void unregisterObject(java.lang.Object clone, int cascadeDepth, boolean forDetach)
public void updateChangeTrackersIfRequired(java.lang.Object objectToWrite, ObjectChangeSet changeSetToWrite, UnitOfWorkImpl uow, ClassDescriptor descriptor)
public void validateObjectSpace()
validateObjectSpace
in interface UnitOfWork
public boolean wasTransactionBegunPrematurely()
public java.lang.Object retryQuery(DatabaseQuery query, AbstractRecord row, DatabaseException databaseException, int retryCount, AbstractSession executionSession)
retryQuery
in class AbstractSession
public void writeChanges()
A subsequent commit (on UnitOfWork or global transaction) will be required to finalize the commit process.
As the commit process has begun any attempt to register objects, or execute object-level queries will generate an exception. Report queries, non-caching queries, and data read/modify queries are allowed.
On exception any global transaction will be rolled back or marked rollback only. No recovery of this UnitOfWork will be possible.
Can only be called once. It can not be used to write out changes in an incremental fashion.
Use to partially commit a transaction outside of a JTA transaction's callbacks. Allows you to get back any exception directly.
Use to commit a UnitOfWork in two stages.
writeChanges
in interface UnitOfWork
public void writesCompleted()
writesCompleted
in class AbstractSession
public java.util.Map<ReadQuery,ReadQuery> getBatchQueries()
public void setBatchQueries(java.util.Map<ReadQuery,ReadQuery> batchQueries)
public java.util.Map getPessimisticLockedObjects()
public void addToChangeTrackedHardList(java.lang.Object obj)
public void addPessimisticLockedClone(java.lang.Object clone)
public void addPrivateOwnedObject(DatabaseMapping mapping, java.lang.Object privateOwnedObject)
public boolean isPessimisticLocked(java.lang.Object clone)
public boolean hasPessimisticLockedObjects()
public boolean isPreDeleteComplete()
public void setWasNonObjectLevelModifyQueryExecuted(boolean wasNonObjectLevelModifyQueryExecuted)
public boolean wasNonObjectLevelModifyQueryExecuted()
public boolean shouldReadFromDB()
public void releaseReadConnection(Accessor connection)
releaseReadConnection
in class AbstractSession
public void clear(boolean shouldClearCache)
public void clearForClose(boolean shouldClearCache)
public boolean shouldClearForCloseOnRelease()
public ReferenceMode getReferenceMode()
public java.util.Set<java.lang.Object> getChangeTrackedHardList()
public java.lang.Object getReference(java.lang.Class theClass, java.lang.Object id)
getReference
in interface UnitOfWork
primaryKey
- - The primary key of the object, either as a List, singleton, IdClass or an instance of the object.public boolean verifyMutexThreadIntegrityBeforeRelease()
public boolean shouldOrderUpdates()
shouldOrderUpdates
in interface UnitOfWork
public void setShouldOrderUpdates(boolean shouldOrderUpdates)
setShouldOrderUpdates
in interface UnitOfWork
public DatabaseValueHolder createCloneQueryValueHolder(ValueHolderInterface attributeValue, java.lang.Object clone, AbstractRecord row, ForeignReferenceMapping mapping)
createCloneQueryValueHolder
in class AbstractSession
public DatabaseValueHolder createCloneTransformationValueHolder(ValueHolderInterface attributeValue, java.lang.Object original, java.lang.Object clone, AbstractTransformationMapping mapping)
createCloneTransformationValueHolder
in class AbstractSession
public java.util.Map<java.lang.Object,java.util.Set<java.lang.Object>> getDeletionDependencies()
public void addDeletionDependency(java.lang.Object target, java.lang.Object source)
public java.util.Set<java.lang.Object> getDeletionDependencies(java.lang.Object deletedObject)
public UnitOfWork.CommitOrderType getCommitOrder()
getCommitOrder
in interface UnitOfWork
public void setCommitOrder(UnitOfWork.CommitOrderType order)
setCommitOrder
in interface UnitOfWork
EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference