org.eclipse.persistence.descriptors
Class AllFieldsLockingPolicy
java.lang.Object
org.eclipse.persistence.descriptors.FieldsLockingPolicy
org.eclipse.persistence.descriptors.AllFieldsLockingPolicy
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy
public class AllFieldsLockingPolicy
- extends FieldsLockingPolicy
Purpose: An implementation of the OptimisticLockingPolicy interface.
This policy compares every field in the table in the WHERE clause
when doing an update or a delete. If any field has been changed, an
optimistic locking exception will be thrown.
NOTE: This policy can only be used inside a unit of work.
- See Also:
- Serialized Form
- Author:
- Peter Krogh
- Since:
- TopLink 2.1
Nested classes/interfaces inherited from interface org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy |
org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy.LockOnChange |
Method Summary |
void |
addLockValuesToTranslationRow(ObjectLevelModifyQuery query)
INTERNAL:
Values to be included in the locking mechanism are added
to the translation row. |
protected java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> |
getFieldsToCompare(org.eclipse.persistence.internal.helper.DatabaseTable table,
org.eclipse.persistence.internal.sessions.AbstractRecord transRow,
org.eclipse.persistence.internal.sessions.AbstractRecord modifyRow)
INTERNAL:
Returns the fields that should be compared in the where clause. |
Methods inherited from class org.eclipse.persistence.descriptors.FieldsLockingPolicy |
addLockFieldsToUpdateRow, buildAllNonPrimaryKeyFields, buildDeleteExpression, buildExpression, buildUpdateExpression, clone, compareWriteLockValues, getAllNonPrimaryKeyFields, getAllNonPrimaryKeyFields, getBaseValue, getLockOnChangeMode, getValueToPutInCache, getVersionDifference, getWriteLockField, getWriteLockUpdateExpression, getWriteLockValue, initialize, initializeProperties, isCascaded, isNewerVersion, isNewerVersion, isPrimaryKey, isStoredInCache, mergeIntoParentCache, setAllNonPrimaryKeyFields, setDescriptor, setLockOnChangeMode, setupWriteFieldsForInsert, shouldUpdateVersionOnMappingChange, shouldUpdateVersionOnOwnedMappingChange, supportsWriteLockValuesComparison, updateRowAndObjectForUpdate, validateDelete, validateUpdate, verifyUsage |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AllFieldsLockingPolicy
public AllFieldsLockingPolicy()
- PUBLIC:
Create a new all fields locking policy.
A field locking policy is based on locking on all fields by comparing with their previous values to detect field-level collisions.
Note: the unit of work must be used for all updates when using field locking.
addLockValuesToTranslationRow
public void addLockValuesToTranslationRow(ObjectLevelModifyQuery query)
- INTERNAL:
Values to be included in the locking mechanism are added
to the translation row. Set the translation row to all the original field values.
- Specified by:
addLockValuesToTranslationRow
in interface org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy
- Specified by:
addLockValuesToTranslationRow
in class FieldsLockingPolicy
getFieldsToCompare
protected java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> getFieldsToCompare(org.eclipse.persistence.internal.helper.DatabaseTable table,
org.eclipse.persistence.internal.sessions.AbstractRecord transRow,
org.eclipse.persistence.internal.sessions.AbstractRecord modifyRow)
- INTERNAL:
Returns the fields that should be compared in the where clause.
In this case, it is all the fields, except for the primary key
and class indicator.
- Specified by:
getFieldsToCompare
in class FieldsLockingPolicy