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 need to provide your own database trigger implementation.

Before you begin

The following are the benefits of choosing to add a column for collision detection over the alternative optimistic concurrency control scheme of including attributes in a predicate for optimistic access intents:
  • In the over-qualified UPDATE statement, only the collision detection column and the primary key are required. Checking that these two columns reduces the number of I/O operations over using multiple selected optimistic predicates.
  • Use of collision detection column overcomes the limitation of optimistic predicate can not map to nullable columns or unsupported optimistic concurrency control data types such as BLOBs and CLOBs.
The following are restrictions of using the collision detection column:
  • Any modifications or updates to the value of collision detection column is not supported.
  • If you choose to use collision detection column, the use of the collision detection column takes 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 is ignored for optimistic access intent.
  • Adding a column for collision detection is available for top-down and meet-in-the middle mapping. Bottom-up mapping is not supported.
  • Column names beginning with "DISCRIM" or "OCC_" are reserved names for the EJB Mapping tools.
    • Do not specify a CMP field name to begin with either the following strings: "DISCRIM" or "OCC_".
    • Do not associate a CMP with another CMP whose name begin with either the following strings: "DISCRIM" and "OCC_".

Select one of the following approaches to add a column for collision detection:


Feedback