Oracle TopLink Developer's Guide
10g Release 3 (10.1.3) B13593-01 |
|
![]() Previous |
![]() Next |
OptimisticLockException
is a run-time exception that is raised when the row on the database that matches the desired object is missing or when the value on the database does not match the registered number. It is used in conjunction with the optimistic locking feature. This applies only on an update or delete operation, as shown in Example 13-5.
For more information about optimistic locking, see the section on Optimistic Locking in a Stateless Environment in Chapter 2, "Understanding TopLink Application Development". These exceptions should be handled in a try-catch block.
Format
EXCEPTION [TOPLINK – error code]: Exception Name EXCEPTION DESCRIPTION: Message
Example 13-5 Optimistic Lock Exception
EXCEPTION [TOPLINK – 5003]: oracle.toplink.exceptions.OptimisticLockException EXCEPTION DESCRIPTION: The object, object.toString() cannot be deleted because it has changed or been deleted since it was last read.
object
, but it has no version number in the identity map. This object either was never read or has already been deleted.
object
cannot be deleted because it has changed or been deleted since it was last read. This usually means that the row in the table was changed by some other application.
object
but it has no version number in the identity map. It may not have been read before being updated, or it has been deleted.
object
cannot be updated because it has changed or been deleted since it was last read. This usually means that the row in the table was changed by some other application.
aClass
must have a nonread-only mapping corresponding to the version lock field. The mapping, which is needed when the lock value is stored in the domain object rather than in a cache, was not defined for the locking field.