Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

B32476-03

oracle.toplink.descriptors
Class SelectedFieldsLockingPolicy

java.lang.Object
  extended by oracle.toplink.descriptors.FieldsLockingPolicy
      extended by 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

Constructor Summary
SelectedFieldsLockingPolicy()
          Create a new selected fields locking policy.
 
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 oracle.toplink.descriptors.FieldsLockingPolicy
isCascaded, isStoredInCache
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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.

Method Detail

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.


Copyright © 1998, 2010, Oracle. All Rights Reserved.