Specifying optimistic concurrency control scheme for EJB 2.x CMP entity beans

Concurrency control is the management of contention for data resources. A concurrency control scheme is considered optimistic when locks are acquired and released over a short period of time at the end of transaction. The objective of optimistic concurrency control is to minimize the time over which a given resource would be unavailable for use by other transactions.

The Mapping editor offers two optimistic concurrency control schemes for EJB 2.x CMP entity beans:

Note: If you choose to use a collision detection column, the use of the collision detection column will take precedence over the alternative optimistic concurrency control scheme of including attributes in a predicate for optimistic access intents. In addition, all the optimistic predicate settings will be ignored for optimistic access intent.

Including an attribute in a predicate for optimistic access intents
For attributes of EJB 2.x CMP entity beans, the Properties view of the Mapping editor includes a property for optimistic predicate.

Adding a column for collision detection
For EJB 2.x CMP entity beans, you can add a column in your relational database table for collision detection. This collision detection column is an additional database column reserved to determine if a record has been updated. To manage the collision detection column, you will need to provide your own database trigger implementation.

 

Parent topic

Updating maps with the Mapping editor