Adding a column for collision detection when the CMP bean exists

This task describes how to add a column for collision detection using the Mapping editor.

Prerequisite tasks

  1. Enable the J2EE and Database Capabilities. You can complete this as follows:

    1. In the workbench preferences page (Windows > Preferences) expand the folder Workbench , select Capabilites.

    2. Under the Capabilities list, select the check boxes: J2EE Developer. Click OK.

  2. Create a version 1.3 or 1.4 enterprise application project with a target server of WebSphere Application Server v6.0..

  3. Create a version 2.x EJB project in the enterprise application project you just created.

  4. Create or import a 2.x CMP beans in the EJB project that correspond to the enterprise application project you just created.

  5. Generated an enterprise bean using either top-down, bottom-up1 or meet-in-the-middle approach.

  6. Created a JDBC Connection.

  7. Set up the optimistic access intent to wsOptimisticUpdate or wsOptimisticRead.

Steps for this task

To generate a collision detection column for EJB 2.x CMP entity bean using the Mapping editor, complete the following:

  1. Open the Mapping Editor.

    1. In the J2EE perspective, expand the EJB project for which you want to add the column for collision detection.

    2. Expand the Deployment Descriptor folder.

    3. Expand the Maps folder. Right-click the database mapping and select Open With > Mapping Editor.

  2. In the Overview section, under Enterprise Beans expand the EJB project folder and select the CMP bean you want to add a column for collision detection.

  3. In the Properties view, expand the Bean to Table Strategy section, use the Column for Collision Detection list to select a column for collision detection.
    Restriction: You need to choose a column that is not mapped to a CMP field, otherwise undefined behavior may occur.

Post task

Before using the collision detection column, complete the following:

  1. Create your own database trigger to support the use of the collision detection column.

 

Parent topic

Adding a column for collision detection

1 Bottom-up mapping is not available in WebSphere Application Server Toolkit or Rational