December 21, 2024

Optimistic Locking:
– Use when multiple processes are not likely to update a row concurrently.
– Does not lock a row.
– Validates data that was written before a final commit (timestamp, version, object comparisions).

Pessimistic Locking:
– Use when multiple processes are likely to update a row concurrently.
– Gets an exclusive lock on a row and nobody else can access that row.

Links:
Locking – SUMit
Optimistic Locking pattern for EJBs
Choosing an Approach for Locking
About optimistic locking
Optimistic Locking pattern for EJBs
Optimistic Algorithm
Optimism vs Locking – CiteSeer