To configure pessimistic concurrency control, you can do one of the following:
Set the <persistentObject> selectWithUpdateLock or selectWithSharedLock attribute to true.
The selectWithUpdateLock setting requests an exclusive database lock be obtained at select time to avoid deadlocks during lock promotion. If you use this setting, also consider configuring the database table for row-level locking.
For databases such as Sybase Adaptive Server Enterprise that do not support select for update locking syntax, EAServer locks rows by issuing a no-change update statement. The <persistentObject> touchColumn attribute specifies which column to update. If you do not set this property, EAServer uses the first non-key column. For best performance, specify the column with the datatype that can be updated most quickly. For example, int columns can be updated more quickly than varchar columns. If no existing column is suitable, consider adding an int column that defaults to 1.
Configure the EJB finder and select methods queries and add “holdlock” or the appropriate lock syntax for your database. For more information, see “Finder and query method configuration”.