Skip navigation links
oracle.toplink.descriptors
Class SelectedFieldsLockingPolicy
java.lang.Object
oracle.toplink.descriptors.FieldsLockingPolicy
oracle.toplink.descriptors.SelectedFieldsLockingPolicy
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, oracle.toplink.internal.descriptors.OptimisticLockingPolicy
-
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.
- Since:
- TopLink 2.5
- See Also:
- Serialized Form
Method Summary |
void |
addLockFieldName(java.lang.String fieldName)
Add a fieldname to lock on. |
void |
setLockFieldNames(java.util.Vector lockFieldNames)
Set the field names to lock on. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SelectedFieldsLockingPolicy
public SelectedFieldsLockingPolicy()
- 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
public void addLockFieldName(java.lang.String fieldName)
- Add a fieldname 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.
setLockFieldNames
public void setLockFieldNames(java.util.Vector lockFieldNames)
- 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.
Skip navigation links