public class SelectedFieldsLockingPolicy extends FieldsLockingPolicy
Purpose: An implementation of the OptimisticLockingPolicy interface. This policy compares selected fields 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 that the fields specified must be mapped and not be primary keys.
NOTE: This policy can only be used inside a unit of work.
Constructor and Description |
---|
SelectedFieldsLockingPolicy()
PUBLIC:
Create a new selected fields locking policy.
|
Modifier and Type | Method and Description |
---|---|
void |
addLockFieldName(String fieldName)
PUBLIC:
Add a fieldname to lock on.
|
void |
addLockValuesToTranslationRow(ObjectLevelModifyQuery query)
INTERNAL:
Values to be included in the locking mechanism are added to the translation row.
|
Vector |
getLockFields()
INTERNAL:
Returns the lock fields
|
void |
initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL:
It is responsible for initializing the policy;
|
void |
setLockFieldNames(Vector lockFieldNames)
PUBLIC:
Set the field names to lock on.
|
void |
setLockFields(Map lockFieldsByTable)
INTERNAL:
Used to set the field names to be used in this policy.
|
addLockFieldsToUpdateRow, buildDeleteExpression, buildUpdateExpression, clone, compareWriteLockValues, getBaseValue, getLockOnChangeMode, getValueToPutInCache, getVersionDifference, getWriteLockField, getWriteLockUpdateExpression, getWriteLockValue, initializeProperties, isCascaded, isNewerVersion, isNewerVersion, isStoredInCache, mergeIntoParentCache, setDescriptor, setLockOnChangeMode, setupWriteFieldsForInsert, shouldUpdateVersionOnMappingChange, shouldUpdateVersionOnOwnedMappingChange, supportsWriteLockValuesComparison, updateRowAndObjectForUpdate, validateDelete, validateUpdate
public SelectedFieldsLockingPolicy()
public void addLockFieldName(String fieldName)
public void addLockValuesToTranslationRow(ObjectLevelModifyQuery query) throws DatabaseException
addLockValuesToTranslationRow
in interface org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy
addLockValuesToTranslationRow
in class FieldsLockingPolicy
DatabaseException
public Vector getLockFields()
public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
initialize
in interface org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy
initialize
in class FieldsLockingPolicy
public void setLockFieldNames(Vector lockFieldNames)
public void setLockFields(Map lockFieldsByTable)