Skip navigation links
oracle.toplink.publicinterface
Class UnitOfWork
java.lang.Object
AbstractSession
oracle.toplink.publicinterface.UnitOfWork
- All Implemented Interfaces:
- Session, UnitOfWork
Deprecated. since OracleAS TopLink 10g (10.1.3). This class is replaced by UnitOfWork
, and oracle.toplink.internal.sessions.UnitOfWorkImpl
- public class UnitOfWork
- extends AbstractSession
- implements UnitOfWork
Implementation of oracle.toplink.sessions.UnitOfWork The public interface should be used.
- See Also:
Purpose: To allow object level transactions.
Description: The unit of work is a session that implements all of the normal protocol of a TopLink 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 opperate on its own object space, that is the objects within the unit of work will be clones of the orignial objects. When the unit of work is commited, all changes to any objects registered within the unit of work will be commited to the database. A minimal commit/update will be performed and any foreign keys/circular reference/referencial 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 occured.
- Resolve foreign keys for newly created objects and maintain referencial integrity.
- Allow for the object transaction to use its own object space.
, Serialized Form
Method Summary |
UnitOfWork |
acquireUnitOfWork()
Deprecated. PUBLIC: Return a nested unit of work for this unit of work. |
void |
addReadOnlyClass(java.lang.Class theClass)
Deprecated. PUBLIC: Adds the given Java class to the receiver's set of read-only classes. |
void |
addReadOnlyClasses(java.util.Vector classes)
Deprecated. PUBLIC: Adds the classes in the given Vector to the existing set of read-only classes. |
void |
assignSequenceNumber(java.lang.Object object)
Deprecated. ADVANCED: Assign sequence number to the object. |
void |
assignSequenceNumbers()
Deprecated. 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()
Deprecated. PUBLIC: Tell the unit of work to begin a transaction now. |
void |
commit()
Deprecated. PUBLIC: Commit the unit of work to its parent. |
void |
commitAndResume()
Deprecated. PUBLIC: Commit the unit of work to its parent. |
void |
commitAndResumeOnFailure()
Deprecated. PUBLIC: Commit the unit of work to its parent. |
java.lang.Object |
deepMergeClone(java.lang.Object rmiClone)
Deprecated. PUBLIC: Merge the attributes of the clone into the unit of work copy. |
java.lang.Object |
deepRevertObject(java.lang.Object clone)
Deprecated. PUBLIC: Revert the object's attributes from the parent. |
void |
deepUnregisterObject(java.lang.Object clone)
Deprecated. ADVANCED: Unregister the object with the unit of work. |
void |
deleteAllObjects(java.util.Vector domainObjects)
Deprecated. PUBLIC: Delete all of the objects and all of their privately owned parts in the database. |
void |
dontPerformValidation()
Deprecated. 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. |
void |
forceUpdateToVersionField(java.lang.Object lockObject, boolean shouldModifyVersionField)
Deprecated. ADVANCED: Set optmistic read lock on the object. |
UnitOfWork |
getActiveUnitOfWork()
Deprecated. PUBLIC: Return the active unit of work for the current active external (JTS) transaction. |
UnitOfWorkChangeSet |
getChanges()
Deprecated. since OracleAS TopLink 10g (10.0.3) |
UnitOfWorkChangeSet |
getCurrentChanges()
Deprecated. ADVANCED: This method Will Calculate the chages for the UnitOfWork. |
MergeManager |
getMergeManager()
Deprecated. A reference to the last used merge manager. |
java.lang.Object |
getOriginalVersionOfObject(java.lang.Object workingClone)
Deprecated. ADVANCED: Return the original version of the object(clone) from the parent's identity map. |
java.lang.Object |
getOriginalVersionOfObjectOrNull(java.lang.Object workingClone)
Deprecated. ADVANCED: Return the original version of the object(clone) from the parent's identity map. |
Session |
getParent()
Deprecated. PUBLIC: Return the parent. |
DatabaseQuery |
getQuery(java.lang.String name)
Deprecated. PUBLIC: Return the query from the session pre-defined queries with the given name. |
DatabaseQuery |
getQuery(java.lang.String name, java.util.Vector arguments)
Deprecated. PUBLIC: Return the query from the session pre-defined queries with the given name. |
UnitOfWorkChangeSet |
getUnitOfWorkChangeSet()
Deprecated. ADVANCED: Returns the currentChangeSet from the UnitOfWork. |
int |
getValidationLevel()
Deprecated. 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 |
hasChanges()
Deprecated. ADVANCED: The Unit of work is capable of preprocessing to determine if any on the clone have been changed. |
boolean |
isActive()
Deprecated. PUBLIC: Return if the unit of work is active. |
boolean |
isInTransaction()
Deprecated. PUBLIC: Return whether the session currently has a database transaction in progress. |
boolean |
isNestedUnitOfWork()
Deprecated. PUBLIC: Return whether this session is a nested unit of work or not. |
boolean |
isUnitOfWork()
Deprecated. PUBLIC: Return if this session is a unit of work. |
java.lang.Object |
mergeClone(java.lang.Object rmiClone)
Deprecated. PUBLIC: Merge the attributes of the clone into the unit of work copy. |
java.lang.Object |
mergeCloneWithReferences(java.lang.Object rmiClone)
Deprecated. PUBLIC: Merge the attributes of the clone into the unit of work copy. |
java.lang.Object |
mergeCloneWithReferences(java.lang.Object rmiClone, int cascadePolicy)
Deprecated. PUBLIC: Merge the attributes of the clone into the unit of work copy. |
java.lang.Object |
newInstance(java.lang.Class theClass)
Deprecated. PUBLIC: Return a new instance of the class registered in this unit of work. |
void |
performFullValidation()
Deprecated. 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. |
void |
performPartialValidation()
Deprecated. 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. |
void |
printRegisteredObjects()
Deprecated. PUBLIC: Print the objects in the unit of work. |
java.util.Vector |
registerAllObjects(java.util.Collection domainObjects)
Deprecated. PUBLIC: Register the objects with the unit of work. |
java.util.Vector |
registerAllObjects(java.util.Vector domainObjects)
Deprecated. PUBLIC: Register the objects with the unit of work. |
java.lang.Object |
registerExistingObject(java.lang.Object existingObject)
Deprecated. ADVANCED: Register the existing object with the unit of work. |
java.lang.Object |
registerNewObject(java.lang.Object newObject)
Deprecated. ADVANCED: Register the new object with the unit of work. |
java.lang.Object |
registerObject(java.lang.Object object)
Deprecated. PUBLIC: Register the object with the unit of work. |
void |
release()
Deprecated. PUBLIC: Release the unit of work. |
void |
removeAllReadOnlyClasses()
Deprecated. PUBLIC: Empties the set of read-only classes. |
void |
removeForceUpdateToVersionField(java.lang.Object lockObject)
Deprecated. ADVANCE: Remove optimistic read lock from the object See forceUpdateToVersionField(Object) |
void |
removeReadOnlyClass(java.lang.Class theClass)
Deprecated. PUBLIC: Removes a Class from the receiver's set of read-only classes. |
void |
revertAndResume()
Deprecated. PUBLIC: Revert all changes made to any registered object. |
java.lang.Object |
revertObject(java.lang.Object clone)
Deprecated. PUBLIC: Revert the object's attributes from the parent. |
void |
setMergeManager(MergeManager mergeManager)
Deprecated. A reference to the last used merge manager. |
void |
setShouldNewObjectsBeCached(boolean shouldNewObjectsBeCached)
Deprecated. ADVANCED: By default new objects are not cached until the exist on the database. |
void |
setShouldPerformDeletesFirst(boolean shouldPerformDeletesFirst)
Deprecated. ADVANCED: By default deletes are performed last in a unit of work. |
void |
setShouldThrowConformExceptions(int shouldThrowExceptions)
Deprecated. 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 |
setValidationLevel(int validationLevel)
Deprecated. 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. |
java.lang.Object |
shallowMergeClone(java.lang.Object rmiClone)
Deprecated. PUBLIC: Merge the attributes of the clone into the unit of work copy. |
java.lang.Object |
shallowRevertObject(java.lang.Object clone)
Deprecated. PUBLIC: Revert the object's attributes from the parent. |
void |
shallowUnregisterObject(java.lang.Object clone)
Deprecated. ADVANCED: Unregister the object with the unit of work. |
boolean |
shouldNewObjectsBeCached()
Deprecated. ADVANCED: By default new objects are not cached until the exist on the database. |
boolean |
shouldPerformDeletesFirst()
Deprecated. ADVANCED: By default all objects are inserted and updated in the database before any object is deleted. |
boolean |
shouldPerformFullValidation()
Deprecated. 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 |
shouldPerformNoValidation()
Deprecated. 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 |
shouldPerformPartialValidation()
Deprecated. 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. |
void |
unregisterObject(java.lang.Object clone)
Deprecated. PUBLIC: Unregister the object with the unit of work. |
void |
validateObjectSpace()
Deprecated. ADVANCED: This can be used to help debugging an object-space corruption. |
void |
writeChanges()
Deprecated. ADVANCED: Writes all changes now before commit(). |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface oracle.toplink.sessions.Session |
addQuery, clearIntegrityChecker, clearProfile, containsObjectInIdentityMap, containsObjectInIdentityMap, containsQuery, copyObject, copyObject, doesObjectExist, dontLogMessages, executeNonSelectingCall, executeNonSelectingSQL, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeSelectingCall, executeSQL, getActiveSession, getAllFromIdentityMap, getAllFromIdentityMap, getAsOfClause, getCacheSynchronizationManager, getClassDescriptor, getClassDescriptor, getClassDescriptorForAlias, getDatasourceLogin, getDescriptor, getDescriptor, getDescriptorForAlias, getDescriptors, getEventManager, getExceptionHandler, getExternalTransactionController, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getIdentityMapAccessor, getIntegrityChecker, getLog, getLogin, getLogLevel, getLogLevel, getName, getNextSequenceNumberValue, getProfiler, getProject, getProperties, getProperty, getQueries, getSessionLog, getWriteLockValue, getWriteLockValue, handleException, handleSevere, hasCacheSynchronizationManager, hasDescriptor, hasExceptionHandler, hasExternalTransactionController, initializeAllIdentityMaps, initializeIdentityMap, initializeIdentityMaps, isClientSession, isConnected, isDatabaseSession, isDistributedSession, isInProfile, isRemoteSession, isRemoteUnitOfWork, isServerSession, isSessionBroker, keyFromObject, log, log, logDebug, logDebug, logException, logMessage, logMessage, logMessages, printIdentityMap, printIdentityMaps, putInIdentityMap, putInIdentityMap, putInIdentityMap, readAllObjects, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, readObject, refreshObject, removeFromIdentityMap, removeFromIdentityMap, removeProperty, removeQuery, setCacheSynchronizationManager, setExceptionHandler, setExternalTransactionController, setIntegrityChecker, setLog, setLogLevel, setName, setProfiler, setProperty, setSessionLog, setSessionLog, setShouldLogMessages, shouldLog, shouldLogMessages, updateWriteLockValue, updateWriteLockValue, usesExternalTransactionController, validateCache |
None
public static final int None
- Deprecated.
- See Also:
- Constant Field Values
Partial
public static final int Partial
- Deprecated.
- See Also:
- Constant Field Values
Full
public static final int Full
- Deprecated.
- See Also:
- Constant Field Values
Birth
public static final int Birth
- Deprecated.
- See Also:
- Constant Field Values
CommitPending
public static final int CommitPending
- Deprecated.
- See Also:
- Constant Field Values
CommitTransactionPending
public static final int CommitTransactionPending
- Deprecated.
- See Also:
- Constant Field Values
WriteChangesFailed
public static final int WriteChangesFailed
- Deprecated.
- See Also:
- Constant Field Values
MergePending
public static final int MergePending
- Deprecated.
- See Also:
- Constant Field Values
Death
public static final int Death
- Deprecated.
- See Also:
- Constant Field Values
AfterExternalTransactionRolledBack
public static final int AfterExternalTransactionRolledBack
- Deprecated.
- See Also:
- Constant Field Values
DO_NOT_THROW_CONFORM_EXCEPTIONS
public static final int DO_NOT_THROW_CONFORM_EXCEPTIONS
- Deprecated.
- Used for Conforming Queries
- See Also:
- Constant Field Values
THROW_ALL_CONFORM_EXCEPTIONS
public static final int THROW_ALL_CONFORM_EXCEPTIONS
- Deprecated.
- See Also:
- Constant Field Values
THROW_ONLY_VALUEHOLDER_EXCEPTIONS
public static final int THROW_ONLY_VALUEHOLDER_EXCEPTIONS
- Deprecated. Since 4.0.1
- See Also:
- Constant Field Values
LOCK_QUERIES_PROPERTY
public static final java.lang.String LOCK_QUERIES_PROPERTY
- Deprecated.
- See Also:
- Constant Field Values
ReadLockOnly
public static final java.lang.String ReadLockOnly
- Deprecated.
- Used for read lock to determine update the version field with the same value or increment value
- See Also:
- Constant Field Values
ReadLockUpdateVersion
public static final java.lang.String ReadLockUpdateVersion
- Deprecated.
- See Also:
- Constant Field Values
acquireUnitOfWork
public UnitOfWork acquireUnitOfWork()
- Deprecated.
- PUBLIC: Return a nested unit of work for this unit of work. A nested unit of work can be used to isolate a subset of work on the unit of work, such as a dialog being open from an editor. The nested unit of work will only commit change to its objects to its parent unit of work, not the database. Only the parent unit of work will commit to the database.
-
- Specified by:
acquireUnitOfWork
in interface Session
-
- See Also:
UnitOfWork
addReadOnlyClass
public void addReadOnlyClass(java.lang.Class theClass)
throws ValidationException
- Deprecated.
- PUBLIC: Adds the given Java class to the receiver's set of read-only classes. Cannot be called after objects have been registered in the unit of work.
-
- Specified by:
addReadOnlyClass
in interface UnitOfWork
-
- Throws:
ValidationException
addReadOnlyClasses
public void addReadOnlyClasses(java.util.Vector classes)
- Deprecated.
- PUBLIC: Adds the classes in the given Vector to the existing set of read-only classes. Cannot be called after objects have been registered in the unit of work.
-
- Specified by:
addReadOnlyClasses
in interface UnitOfWork
assignSequenceNumber
public void assignSequenceNumber(java.lang.Object object)
throws DatabaseException
- Deprecated.
- ADVANCED: Assign sequence number to the object. This allows for an object's id to be assigned before commit. It can be used if the application requires to use the object id before the object exists on the database. Normally all ids are assigned during the commit automatically.
-
- Specified by:
assignSequenceNumber
in interface UnitOfWork
-
- Throws:
DatabaseException
assignSequenceNumbers
public void assignSequenceNumbers()
throws DatabaseException
- Deprecated.
- ADVANCED: Assign sequence numbers to all new objects registered in this unit of work, or any new objects reference by any objects registered. This allows for an object's id to be assigned before commit. It can be used if the application requires to use the object id before the object exists on the database. Normally all ids are assigned during the commit automatically.
-
- Specified by:
assignSequenceNumbers
in interface UnitOfWork
-
- Throws:
DatabaseException
beginEarlyTransaction
public void beginEarlyTransaction()
throws DatabaseException
- Deprecated.
- PUBLIC: Tell the unit of work to begin a transaction now. By default the unit of work will begin a transaction at commit time. The default is the recommended approach, however sometimes it is neccessary to start the transaction before commit time. When the unit of work commits, this transcation will be commited.
-
- Specified by:
beginEarlyTransaction
in interface UnitOfWork
-
- Throws:
DatabaseException
- See Also:
commit()
, release()
commit
public void commit()
throws DatabaseException,
OptimisticLockException
- Deprecated.
- PUBLIC: Commit the unit of work to its parent. For a nested unit of work this will merge any changes to its objects with its parents. For a first level unit of work it will commit all changes to its objects to the database as a single transaction. If successful the changes to its objects will be merged to its parent's objects. If the commit fails the database transaction will be rolledback, and the unit of work will be released. If the commit is successful the unit of work is released, and a new unit of work must be acquired if further changes are desired.
-
- Specified by:
commit
in interface UnitOfWork
-
- Throws:
DatabaseException
OptimisticLockException
- See Also:
commitAndResumeOnFailure()
, commitAndResume()
, release()
commitAndResume
public void commitAndResume()
throws DatabaseException,
OptimisticLockException
- Deprecated.
- PUBLIC: Commit the unit of work to its parent. For a nested unit of work this will merge any changes to its objects with its parents. For a first level unit of work it will commit all changes to its objects to the database as a single transaction. If successful the changes to its objects will be merged to its parent's objects. If the commit fails the database transaction will be rolledback, and the unit of work will be released. The normal commit releases the unit of work, forcing a new one to be acquired if further changes are desired. The resuming feature allows for the same unit of work (and working copies) to be continued to be used.
-
- Specified by:
commitAndResume
in interface UnitOfWork
-
- Throws:
DatabaseException
OptimisticLockException
- See Also:
commitAndResumeOnFailure()
, commit()
, release()
commitAndResumeOnFailure
public void commitAndResumeOnFailure()
throws DatabaseException,
OptimisticLockException
- Deprecated.
- PUBLIC: Commit the unit of work to its parent. For a nested unit of work this will merge any changes to its objects with its parents. For a first level unit of work it will commit all changes to its objects to the database as a single transaction. If successful the changes to its objects will be merged to its parent's objects. If the commit fails the database transaction will be rolledback, but the unit of work will remain active. It can then be retried or released. The normal commit failure releases the unit of work, forcing a new one to be acquired if further changes are desired. The resuming feature allows for the same unit of work (and working copies) to be continued to be used if an error occurs. The UnitOfWork will also remain active if the commit is successful.
-
- Specified by:
commitAndResumeOnFailure
in interface UnitOfWork
-
- Throws:
DatabaseException
OptimisticLockException
- See Also:
commit()
, release()
deepMergeClone
public java.lang.Object deepMergeClone(java.lang.Object rmiClone)
- Deprecated.
- PUBLIC: Merge the attributes of the clone into the unit of work copy. This can be used for objects that are returned from the client through RMI serialization or other serialization mechanisms, because the RMI object will be a clone this will merge its attributes correctly to preserve object identity within the unit of work and record its changes. Everything connected to this object (i.e. the entire object tree where rmiClone is the root) is also merged.
-
- Specified by:
deepMergeClone
in interface UnitOfWork
-
- Returns:
- the registered version for the clone being merged.
- See Also:
mergeClone(Object)
, shallowMergeClone(Object)
deepRevertObject
public java.lang.Object deepRevertObject(java.lang.Object clone)
- Deprecated.
- PUBLIC: Revert the object's attributes from the parent. This reverts everything the object references.
-
- Specified by:
deepRevertObject
in interface UnitOfWork
-
- Returns:
- the object reverted.
- See Also:
revertObject(Object)
, shallowRevertObject(Object)
deepUnregisterObject
public void deepUnregisterObject(java.lang.Object clone)
- Deprecated.
- ADVANCED: Unregister the object with the unit of work. This can be used to delete an object that was just created and is not yet persistent. Delete object can also be used, but will result in inserting the object and then deleting it. The method should be used carefully because it will delete all the reachable parts.
-
- Specified by:
deepUnregisterObject
in interface UnitOfWork
deleteAllObjects
public void deleteAllObjects(java.util.Vector domainObjects)
- Deprecated.
- PUBLIC: Delete all of the objects and all of their privately owned parts in the database. Delete operations are delayed in a unit of work until commit.
-
- Specified by:
deleteAllObjects
in interface UnitOfWork
dontPerformValidation
public void dontPerformValidation()
- Deprecated.
- 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. The level of validation can be increased or decreased for debugging purposes or under advanced situation where the application requires/desires to violate clone identity in the unit of work. It is strongly suggested that clone identity not be violate in the unit of work.
-
- Specified by:
dontPerformValidation
in interface UnitOfWork
forceUpdateToVersionField
public void forceUpdateToVersionField(java.lang.Object lockObject,
boolean shouldModifyVersionField)
- Deprecated.
- ADVANCED: Set optmistic read lock on the object. This feature is overide by normal optimistic lock. when the object is changed in UnitOfWork. The cloneFromUOW must be the clone of from this UnitOfWork and it must implements version locking or timestamp locking. The SQL would look like the followings. If shouldModifyVersionField is true, "UPDATE EMPLOYEE SET VERSION = 2 WHERE EMP_ID = 9 AND VERSION = 1" If shouldModifyVersionField is false, "UPDATE EMPLOYEE SET VERSION = 1 WHERE EMP_ID = 9 AND VERSION = 1"
-
- Specified by:
forceUpdateToVersionField
in interface UnitOfWork
getActiveUnitOfWork
public UnitOfWork getActiveUnitOfWork()
- Deprecated.
- PUBLIC: Return the active unit of work for the current active external (JTS) transaction. This should only be used with JTS and will return null if no external transaction exists.
-
- Specified by:
getActiveUnitOfWork
in interface Session
getChanges
public UnitOfWorkChangeSet getChanges()
- Deprecated. since OracleAS TopLink 10g (10.0.3)
- ADVANCED: This method Will Calculate the chages for the UnitOfWork. Without assigning sequence numbers This is a Computationaly intensive operation and should be avoided unless necessary. A valid changeSet, with sequencenumbers can be collected from the UnitOfWork After the commit is complete by calling unitOfWork.getUnitOfWorkChangeSet()
getCurrentChanges
public UnitOfWorkChangeSet getCurrentChanges()
- Deprecated.
- ADVANCED: This method Will Calculate the chages for the UnitOfWork. Without assigning sequence numbers This is a Computationaly intensive operation and should be avoided unless necessary. A valid changeSet, with sequencenumbers can be collected from the UnitOfWork After the commit is complete by calling unitOfWork.getUnitOfWorkChangeSet()
-
- Specified by:
getCurrentChanges
in interface UnitOfWork
getMergeManager
public MergeManager getMergeManager()
- Deprecated.
- A reference to the last used merge manager. This is used to track locked objects.
getOriginalVersionOfObject
public java.lang.Object getOriginalVersionOfObject(java.lang.Object workingClone)
- Deprecated.
- ADVANCED: Return the original version of the object(clone) from the parent's identity map.
-
- Specified by:
getOriginalVersionOfObject
in interface UnitOfWork
getOriginalVersionOfObjectOrNull
public java.lang.Object getOriginalVersionOfObjectOrNull(java.lang.Object workingClone)
- Deprecated.
- ADVANCED: Return the original version of the object(clone) from the parent's identity map.
getParent
public Session getParent()
- Deprecated.
- PUBLIC: Return the parent. This is a unit of work if nested, otherwise a database session or client session.
-
- Specified by:
getParent
in interface UnitOfWork
getQuery
public DatabaseQuery getQuery(java.lang.String name,
java.util.Vector arguments)
- Deprecated.
- PUBLIC: Return the query from the session pre-defined queries with the given name. This allows for common queries to be pre-defined, reused and executed by name.
-
- Specified by:
getQuery
in interface Session
getQuery
public DatabaseQuery getQuery(java.lang.String name)
- Deprecated.
- PUBLIC: Return the query from the session pre-defined queries with the given name. This allows for common queries to be pre-defined, reused and executed by name.
-
- Specified by:
getQuery
in interface Session
getUnitOfWorkChangeSet
public UnitOfWorkChangeSet getUnitOfWorkChangeSet()
- Deprecated.
- ADVANCED: Returns the currentChangeSet from the UnitOfWork. This is only valid after the UnitOfWOrk has commited successfully
-
- Specified by:
getUnitOfWorkChangeSet
in interface UnitOfWork
getValidationLevel
public int getValidationLevel()
- Deprecated.
- 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. The level of validation can be increased or decreased for debugging purposes or under advanced situation where the application requires/desires to violate clone identity in the unit of work. It is strongly suggested that clone identity not be violate in the unit of work.
-
- Specified by:
getValidationLevel
in interface UnitOfWork
hasChanges
public boolean hasChanges()
- Deprecated.
- ADVANCED: The Unit of work is capable of preprocessing to determine if any on the clone have been changed. This is computationaly expensive and should be avoided on large object graphs.
-
- Specified by:
hasChanges
in interface UnitOfWork
isActive
public boolean isActive()
- Deprecated.
- PUBLIC: Return if the unit of work is active. (i.e. has not been released).
-
- Specified by:
isActive
in interface UnitOfWork
isInTransaction
public boolean isInTransaction()
- Deprecated.
- PUBLIC: Return whether the session currently has a database transaction in progress.
isNestedUnitOfWork
public boolean isNestedUnitOfWork()
- Deprecated.
- PUBLIC: Return whether this session is a nested unit of work or not.
-
- Specified by:
isNestedUnitOfWork
in interface UnitOfWork
isUnitOfWork
public boolean isUnitOfWork()
- Deprecated.
- PUBLIC: Return if this session is a unit of work.
-
- Specified by:
isUnitOfWork
in interface Session
mergeClone
public java.lang.Object mergeClone(java.lang.Object rmiClone)
- Deprecated.
- PUBLIC: Merge the attributes of the clone into the unit of work copy. This can be used for objects that are returned from the client through RMI serialization (or another serialization mechanism), because the RMI object will be a clone this will merge its attributes correctly to preserve object identity within the unit of work and record its changes. The object and its private owned parts are merged.
-
- Specified by:
mergeClone
in interface UnitOfWork
-
- Returns:
- the registered version for the clone being merged.
- See Also:
shallowMergeClone(Object)
, deepMergeClone(Object)
mergeCloneWithReferences
public java.lang.Object mergeCloneWithReferences(java.lang.Object rmiClone)
- Deprecated.
- PUBLIC: Merge the attributes of the clone into the unit of work copy. This can be used for objects that are returned from the client through RMI serialization (or another serialization mechanism), because the RMI object will be a clone this will merge its attributes correctly to preserve object identity within the unit of work and record its changes. The object and its private owned parts are merged. This will include references from dependent objects to independent objects.
-
- Specified by:
mergeCloneWithReferences
in interface UnitOfWork
-
- Returns:
- the registered version for the clone being merged.
- See Also:
shallowMergeClone(Object)
, deepMergeClone(Object)
mergeCloneWithReferences
public java.lang.Object mergeCloneWithReferences(java.lang.Object rmiClone,
int cascadePolicy)
- Deprecated.
- PUBLIC: Merge the attributes of the clone into the unit of work copy. This can be used for objects that are returned from the client through RMI serialization (or another serialization mechanism), because the RMI object will be a clone this will merge its attributes correctly to preserve object identity within the unit of work and record its changes. The object and its private owned parts are merged. This will include references from dependent objects to independent objects.
-
- Returns:
- the registered version for the clone being merged.
- See Also:
shallowMergeClone(Object)
, deepMergeClone(Object)
newInstance
public java.lang.Object newInstance(java.lang.Class theClass)
- Deprecated.
- PUBLIC: Return a new instance of the class registered in this unit of work. This can be used to ensure that new objects are registered correctly.
-
- Specified by:
newInstance
in interface UnitOfWork
performFullValidation
public void performFullValidation()
- Deprecated.
- 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. The level of validation can be increased or decreased for debugging purposes or under advanced situation where the application requires/desires to violate clone identity in the unit of work. It is strongly suggested that clone identity not be violate in the unit of work.
-
- Specified by:
performFullValidation
in interface UnitOfWork
performPartialValidation
public void performPartialValidation()
- Deprecated.
- 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. The level of validation can be increased or decreased for debugging purposes or under advanced situation where the application requires/desires to violate clone identity in the unit of work. It is strongly suggested that clone identity not be violate in the unit of work.
-
- Specified by:
performPartialValidation
in interface UnitOfWork
printRegisteredObjects
public void printRegisteredObjects()
- Deprecated.
- PUBLIC: Print the objects in the unit of work. The output of this method will be logged to this unit of work's SessionLog at SEVERE level.
-
- Specified by:
printRegisteredObjects
in interface UnitOfWork
registerAllObjects
public java.util.Vector registerAllObjects(java.util.Collection domainObjects)
- Deprecated.
- PUBLIC: Register the objects with the unit of work. All newly created root domain objects must be registered to be inserted on commit. Also any existing objects that will be edited and were not read from this unit of work must also be registered. Once registered any changes to the objects will be commited to the database on commit.
-
- Specified by:
registerAllObjects
in interface UnitOfWork
-
- Returns:
- is the clones of the original objects, the return value must be used for editing. Editing the original is not allowed in the unit of work.
registerAllObjects
public java.util.Vector registerAllObjects(java.util.Vector domainObjects)
throws DatabaseException,
OptimisticLockException
- Deprecated.
- PUBLIC: Register the objects with the unit of work. All newly created root domain objects must be registered to be inserted on commit. Also any existing objects that will be edited and were not read from this unit of work must also be registered. Once registered any changes to the objects will be commited to the database on commit.
-
- Specified by:
registerAllObjects
in interface UnitOfWork
-
- Returns:
- is the clones of the original objects, the return value must be used for editing. Editing the original is not allowed in the unit of work.
- Throws:
DatabaseException
OptimisticLockException
registerExistingObject
public java.lang.Object registerExistingObject(java.lang.Object existingObject)
- Deprecated.
- ADVANCED: Register the existing object with the unit of work. This is a advanced API that can be used if the application can guarentee the object exists on the database. When registerObject is called the unit of work determines existence through the descriptor's doesExist setting.
-
- Specified by:
registerExistingObject
in interface UnitOfWork
-
- Returns:
- The clone of the original object, the return value must be used for editing. Editing the original is not allowed in the unit of work.
registerNewObject
public java.lang.Object registerNewObject(java.lang.Object newObject)
- Deprecated.
- 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 interface UnitOfWork
-
- See Also:
registerObject(Object)
registerObject
public java.lang.Object registerObject(java.lang.Object object)
- Deprecated.
- PUBLIC: Register the object with the unit of work. All newly created root domain objects must be registered to be inserted on commit. Also any existing objects that will be edited and were not read from this unit of work must also be registered. Once registered any changes to the objects will be commited to the database on commit.
-
- Specified by:
registerObject
in interface UnitOfWork
-
- Returns:
- the clone of the original object, the return value must be used for editing, ** Editing the original is not allowed in the unit of work. **
removeForceUpdateToVersionField
public void removeForceUpdateToVersionField(java.lang.Object lockObject)
- Deprecated.
- ADVANCE: Remove optimistic read lock from the object See forceUpdateToVersionField(Object)
-
- Specified by:
removeForceUpdateToVersionField
in interface UnitOfWork
release
public void release()
- Deprecated.
- PUBLIC: Release the unit of work. This terminates this unit of work. Because the unit of work operates on its own object space (clones) no work is required. The unit of work should no longer be used or referenced by the application beyond this point so that it can be garbage collected.
-
- Specified by:
release
in interface UnitOfWork
-
- See Also:
commit()
removeAllReadOnlyClasses
public void removeAllReadOnlyClasses()
throws ValidationException
- Deprecated.
- PUBLIC: Empties the set of read-only classes. It is illegal to call this method on nested UnitOfWork objects. A nested UnitOfWork cannot have a subset of its parent's set of read-only classes. Also removes classes which are read only because their descriptors are readonly
-
- Specified by:
removeAllReadOnlyClasses
in interface UnitOfWork
-
- Throws:
ValidationException
removeReadOnlyClass
public void removeReadOnlyClass(java.lang.Class theClass)
throws ValidationException
- Deprecated.
- PUBLIC: Removes a Class from the receiver's set of read-only classes. It is illegal to try to send this method to a nested UnitOfWork.
-
- Specified by:
removeReadOnlyClass
in interface UnitOfWork
-
- Throws:
ValidationException
revertAndResume
public void revertAndResume()
- Deprecated.
- PUBLIC: Revert all changes made to any registered object. Clear all deleted and new objects. Revert should not be confused with release which it the normal compliment to commit. Revert is more similar to commit and resume, however reverts all changes and resumes. If you do not require to resume the unit of work release should be used instead.
-
- Specified by:
revertAndResume
in interface UnitOfWork
-
- See Also:
commitAndResume()
, release()
revertObject
public java.lang.Object revertObject(java.lang.Object clone)
- Deprecated.
- PUBLIC: Revert the object's attributes from the parent. This also reverts the object privately-owned parts.
-
- Specified by:
revertObject
in interface UnitOfWork
-
- Returns:
- the object reverted.
- See Also:
shallowRevertObject(Object)
, deepRevertObject(Object)
setMergeManager
public void setMergeManager(MergeManager mergeManager)
- Deprecated.
- A reference to the last used merge manager. This is used to track locked objects.
setShouldNewObjectsBeCached
public void setShouldNewObjectsBeCached(boolean shouldNewObjectsBeCached)
- Deprecated.
- ADVANCED: By default new objects are not cached until the exist on the database. Occasionally if mergeClone is used on new objects and is required to allow multiple merges on the same new object, then if the new objects are not cached, each mergeClone will be interpretted as a different new object. By setting new objects to be cached mergeClone can be performed multiple times before commit. New objects cannot be cached unless they have a valid assigned primary key before being registered. New object with non-null invalid primary keys such as 0 or '' can cause problems and should not be used with this option.
-
- Specified by:
setShouldNewObjectsBeCached
in interface UnitOfWork
setShouldPerformDeletesFirst
public void setShouldPerformDeletesFirst(boolean shouldPerformDeletesFirst)
- Deprecated.
- ADVANCED: By default deletes are performed last in a unit of work. Sometimes you may want to have the deletes performed before other actions.
-
- Specified by:
setShouldPerformDeletesFirst
in interface UnitOfWork
setShouldThrowConformExceptions
public void setShouldThrowConformExceptions(int shouldThrowExceptions)
- Deprecated.
- 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;
-
- Specified by:
setShouldThrowConformExceptions
in interface UnitOfWork
setValidationLevel
public void setValidationLevel(int validationLevel)
- Deprecated.
- 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. The level of validation can be increased or decreased for debugging purposes or under advanced situation where the application requires/desires to violate clone identity in the unit of work. It is strongly suggested that clone identity not be violate in the unit of work.
-
- Specified by:
setValidationLevel
in interface UnitOfWork
shallowMergeClone
public java.lang.Object shallowMergeClone(java.lang.Object rmiClone)
- Deprecated.
- PUBLIC: Merge the attributes of the clone into the unit of work copy. This can be used for objects that are returned from the client through RMI serialization (or other serialization mechanisms), because the RMI object will be a clone this will merge its attributes correctly to preserve object identity within the unit of work and record its changes. Only direct attributes are merged.
-
- Specified by:
shallowMergeClone
in interface UnitOfWork
-
- Returns:
- the registered version for the clone being merged.
- See Also:
mergeClone(Object)
, deepMergeClone(Object)
shallowRevertObject
public java.lang.Object shallowRevertObject(java.lang.Object clone)
- Deprecated.
- PUBLIC: Revert the object's attributes from the parent. This only reverts the object's direct attributes.
-
- Specified by:
shallowRevertObject
in interface UnitOfWork
-
- Returns:
- the object reverted.
- See Also:
revertObject(Object)
, deepRevertObject(Object)
shallowUnregisterObject
public void shallowUnregisterObject(java.lang.Object clone)
- Deprecated.
- ADVANCED: Unregister the object with the unit of work. This can be used to delete an object that was just created and is not yet persistent. Delete object can also be used, but will result in inserting the object and then deleting it. The method will only unregister the clone, none of its parts.
-
- Specified by:
shallowUnregisterObject
in interface UnitOfWork
shouldNewObjectsBeCached
public boolean shouldNewObjectsBeCached()
- Deprecated.
- ADVANCED: By default new objects are not cached until the exist on the database. Occasionally if mergeClone is used on new objects and is required to allow multiple merges on the same new object, then if the new objects are not cached, each mergeClone will be interpretted as a different new object. By setting new objects to be cached mergeClone can be performed multiple times before commit. New objects cannot be cached unless they have a valid assigned primary key before being registered. New object with non-null invalid primary keys such as 0 or '' can cause problems and should not be used with this option.
-
- Specified by:
shouldNewObjectsBeCached
in interface UnitOfWork
shouldPerformDeletesFirst
public boolean shouldPerformDeletesFirst()
- Deprecated.
- ADVANCED: By default all objects are inserted and updated in the database before any object is deleted. If this flag is set to true, deletes will be performed before inserts and updates
-
- Specified by:
shouldPerformDeletesFirst
in interface UnitOfWork
shouldPerformFullValidation
public boolean shouldPerformFullValidation()
- Deprecated.
- 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. The level of validation can be increased or decreased for debugging purposes or under advanced situation where the application requires/desires to violate clone identity in the unit of work. It is strongly suggested that clone identity not be violate in the unit of work.
-
- Specified by:
shouldPerformFullValidation
in interface UnitOfWork
shouldPerformNoValidation
public boolean shouldPerformNoValidation()
- Deprecated.
- 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. The level of validation can be increased or decreased for debugging purposes or under advanced situation where the application requires/desires to violate clone identity in the unit of work. It is strongly suggested that clone identity not be violate in the unit of work.
-
- Specified by:
shouldPerformNoValidation
in interface UnitOfWork
shouldPerformPartialValidation
public boolean shouldPerformPartialValidation()
- Deprecated.
- 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. The level of validation can be increased or decreased for debugging purposes or under advanced situation where the application requires/desires to violate clone identity in the unit of work. It is strongly suggested that clone identity not be violate in the unit of work.
-
- Specified by:
shouldPerformPartialValidation
in interface UnitOfWork
unregisterObject
public void unregisterObject(java.lang.Object clone)
- Deprecated.
- PUBLIC: Unregister the object with the unit of work. This can be used to delete an object that was just created and is not yet persistent. Delete object can also be used, but will result in inserting the object and then deleting it. The method will only unregister the object and its privately owned parts
-
- Specified by:
unregisterObject
in interface UnitOfWork
validateObjectSpace
public void validateObjectSpace()
- Deprecated.
- ADVANCED: This can be used to help debugging an object-space corruption. An object-space corruption is when your application has incorrectly related a clone to an original object. This method will validate that all registered objects are in a correct state and throw an error if not, it will contain the full stack of object references in the error message. If you call this method after each register or change you perform it will pin-point where the error was made.
-
- Specified by:
validateObjectSpace
in interface UnitOfWork
writeChanges
public void writeChanges()
- Deprecated.
- ADVANCED: Writes all changes now before commit(). The commit process will begin and all changes will be written out to the datastore, but the datastore transaction will not be committed, nor will changes be merged into the global cache.
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.
-
- Specified by:
writeChanges
in interface UnitOfWork
Skip navigation links