public class ChangedFieldsLockingPolicy extends FieldsLockingPolicy
Purpose: An implementation of the OptimisticLockingPolicy interface. This policy compares only the changed fields in the WHERE clause when doing an update. If any field has been changed, an optimistic locking exception will be thrown. A delete will only compare the primary key.
NOTE: This policy can only be used inside a unit of work.
allNonPrimaryKeyFields, descriptor| Constructor and Description |
|---|
ChangedFieldsLockingPolicy()
PUBLIC:
Create a new changed fields locking policy.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLockValuesToTranslationRow(ObjectLevelModifyQuery query)
INTERNAL:
Values to be included in the locking mechanism are added to the translation row.
|
Expression |
buildDeleteExpression(org.eclipse.persistence.internal.helper.DatabaseTable table,
Expression mainExpression,
org.eclipse.persistence.internal.sessions.AbstractRecord row)
INTERNAL:
When given an expression, this method will return a new expression with the optimistic
locking values included.
|
protected 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.
|
addLockFieldsToUpdateRow, buildAllNonPrimaryKeyFields, buildExpression, buildUpdateExpression, clone, compareWriteLockValues, getAllNonPrimaryKeyFields, getAllNonPrimaryKeyFields, getBaseValue, getLockOnChangeMode, getValueToPutInCache, getVersionDifference, getWriteLockField, getWriteLockUpdateExpression, getWriteLockValue, initialize, initializeProperties, isCascaded, isNewerVersion, isNewerVersion, isPrimaryKey, isStoredInCache, mergeIntoParentCache, mergeIntoParentCache, setAllNonPrimaryKeyFields, setDescriptor, setLockOnChangeMode, setupWriteFieldsForInsert, shouldUpdateVersionOnMappingChange, shouldUpdateVersionOnOwnedMappingChange, supportsWriteLockValuesComparison, updateRowAndObjectForUpdate, validateDelete, validateUpdate, verifyUsagepublic ChangedFieldsLockingPolicy()
public void addLockValuesToTranslationRow(ObjectLevelModifyQuery query)
addLockValuesToTranslationRow in interface org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicyaddLockValuesToTranslationRow in class FieldsLockingPolicypublic Expression buildDeleteExpression(org.eclipse.persistence.internal.helper.DatabaseTable table, Expression mainExpression, org.eclipse.persistence.internal.sessions.AbstractRecord row)
buildDeleteExpression in interface org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicybuildDeleteExpression in class FieldsLockingPolicyprotected 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)
getFieldsToCompare in class FieldsLockingPolicyCopyright © 2007–2021 Eclipse.org - EclipseLink Project. All rights reserved.