The following locking policies, included in TopLink, do not require any additional fields:
All these policies compare the current values of certain mapped previous values. When using these policies, a UnitOfWork must be employed for updating the database. Each policy handles its field comparisons in specific way, as defined by the policy.
AllFieldsLockingPolicy is updated or deleted, all the fields in that table are compared in the where clause. If any value in that table has been changed since the object was read, the update or delete fails.where clause.ChangedFieldsLockingPolicy is updated, only the modified fields are compared. This allows for multiple clients to modify different parts of the same row without failure. Using this policy, a delete compares only on the primary key. SelectedFieldsLockingPolicy is updated or deleted, a list of selected fields is compared in the statement. Updating these fields must be done by the application manually or through an event.Whenever any update fails because optimistic locking has been violated, an OptimisticLockException is thrown. This should be handled by the application when performing any database modification The application must refresh the object and reapply its changes.
Copyright © 1997, 2004, Oracle. All rights reserved.