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.
| Modifier and Type | Field and Description |
|---|---|
| protected List | |
| protected Map |
| Access | Constructor and Description |
|---|---|
| public |
| lockFields | back to summary |
|---|---|
| protected List<DatabaseField> lockFields | |
| lockFieldsByTable | back to summary |
|---|---|
| protected Map<DatabaseTable, List<DatabaseField>> lockFieldsByTable | |
| SelectedFieldsLockingPolicy | back to summary |
|---|---|
| public SelectedFieldsLockingPolicy() PUBLIC: Create a new selected fields locking policy. A field locking policy is based on locking on the specified 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. | |
| addLockFieldName | back to summary |
|---|---|
| public void addLockFieldName(String fieldName) PUBLIC: Add a field name to lock on. All fields in this list will be compared when updating if the value of any of the fields does not match the value in memory, an OptimisticLockException will be thrown. Note An Automatic update will not be done on this field, only a comparison occurs. | |
| addLockValuesToTranslationRow | back to summary |
|---|---|
| public void addLockValuesToTranslationRow(ObjectLevelModifyQuery query) throws DatabaseException Implements abstract org. Implements org. INTERNAL: Values to be included in the locking mechanism are added to the translation row. For changed fields the normal build row is ok as only changed fields matter.
| |
| getFieldsToCompare | back to summary |
|---|---|
| protected List Implements abstract org. INTERNAL: returns the lock fields to compare based on the passed in table.
| |
| getLockFields | back to summary |
|---|---|
| public List INTERNAL: Returns the lock fields | |
| getLockFields | back to summary |
|---|---|
| protected List INTERNAL: returns the lock fields based on the passed in table | |
| getLockFieldsByTable | back to summary |
|---|---|
| protected Map INTERNAL: returns the lock fields | |
| initialize | back to summary |
|---|---|
| public void initialize(AbstractSession session) Overrides org. Implements org. INTERNAL: It is responsible for initializing the policy;
| |
| setLockFieldNames | back to summary |
|---|---|
| public void setLockFieldNames(List<String> lockFieldNames) PUBLIC: Set the field names to lock on. All fields in this list will be compared when Updating. If the value of any of the fields does not match the value in memory, an OptimisticLockException will be thrown. Note An Automatic update will not be done on this field, only a comparison occurs. | |
| setLockFields | back to summary |
|---|---|
| protected void setLockFields(List<DatabaseField> lockFields) INTERNAL: Sets the lock fields | |
| setLockFieldsByTable | back to summary |
|---|---|
| protected void setLockFieldsByTable(Map<DatabaseTable, List<DatabaseField>> lockFieldsByTable) INTERNAL: Used to set the field names to be used in this policy. | |