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
- Enable the J2EE and Database Capabilities. You can complete this as follows:
- In the workbench preferences page (Windows > Preferences) expand the folder Workbench , select Capabilites.
- Under the Capabilities list, select the check boxes: J2EE Developer. Click OK.
- Create a version 1.3 or 1.4 enterprise application project with a target server of WebSphere Application Server v6.0..
- Create a version 2.x EJB project in the enterprise application project you just created.
- Create or import a 2.x CMP beans in the EJB project that correspond to the enterprise application project you just created.
- Generated an enterprise bean using either top-down, bottom-up1 or meet-in-the-middle approach.
- Created a JDBC Connection.
- 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:
- Open the Mapping Editor.
- In the J2EE perspective, expand the EJB project for which you want to add the column for collision detection.
- Expand the Deployment Descriptor folder.
- Expand the Maps folder. Right-click the database mapping and select Open With > Mapping Editor.
- 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.
- 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:
- 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