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(java.lang.String fieldName)
PUBLIC: Add a field name to lock on.
|
void |
addLockValuesToTranslationRow(ObjectLevelModifyQuery query)
INTERNAL: Values to be included in the locking mechanism are added to the
translation row.
|
java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> |
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(java.util.List<java.lang.String> lockFieldNames)
PUBLIC: Set the field names to lock on.
|
addLockFieldsToUpdateRow, buildDeleteExpression, buildUpdateExpression, clone, compareWriteLockValues, getBaseValue, getLockOnChangeMode, getValueToPutInCache, getVersionDifference, getWriteLockField, getWriteLockUpdateExpression, getWriteLockValue, initializeProperties, isCascaded, isNewerVersion, isNewerVersion, isStoredInCache, mergeIntoParentCache, mergeIntoParentCache, setDescriptor, setLockOnChangeMode, setupWriteFieldsForInsert, shouldUpdateVersionOnMappingChange, shouldUpdateVersionOnOwnedMappingChange, supportsWriteLockValuesComparison, updateRowAndObjectForUpdate, validateDelete, validateUpdate
public SelectedFieldsLockingPolicy()
public void addLockFieldName(java.lang.String fieldName)
public void addLockValuesToTranslationRow(ObjectLevelModifyQuery query) throws DatabaseException
addLockValuesToTranslationRow
in interface org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy
addLockValuesToTranslationRow
in class FieldsLockingPolicy
DatabaseException
public java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> 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(java.util.List<java.lang.String> lockFieldNames)