Set the run time for CMP sequence groups
Before you begin
By designating CMP sequence groups for entity beans, one can prevent certain types of database-related exceptions from occurring during the run time of your EJB application. Within each group you specify the order in which the beans update your relational database tables.When you define a sequence group, you designate it as one of two types:
- RI_INSERT, for setting a bean persistence sequence to prevent database referential integrity (RI) violations
- UPDATE_LOCK, for setting a bean persistence sequence to minimize exceptions resulting from optimistic concurrency control
Overview
Both types of sequence groups must be created after you have assembled the beans into an EJB module, prior to installing your application on the product. If we need to edit sequence groups, uninstall the application, make your changes using the following steps as a guide, and then reinstall your application.Note: If you already selected or plan to use top-down mapping for mapping your enterprise beans to back end data, you do not need to create a sequence group with an RI_INSERT type. The product does not generate an RI policy for the database schema that it creates when you select top-down mapping.
Procedure
- Start the assembly tool.
- Open the J2EE perspective. Click Window > Open perspective > J2EE.
- In a J2EE hierarchy view (Window > Show view > J2EE hierarchy), right-click the EJB module containing beans that require sequence grouping, and click Open with > EJB deployment descriptor editor. The EJB deployment descriptor editor for the module is displayed in a view.
- Click the Overview tab.
- In the EJB CMP sequence groups section, click Add. The EJB CMP Sequence Group wizard panel is displayed.
- Type a name for your sequence group.
- Type your group type designation in all capital letters: RI_INSERT or UPDATE_LOCK
- In the Available Beans list, highlight the first bean that you want to place in the group. Click the arrow pointing toward the Selected beans list. The bean name is removed from the Available beans list and is displayed in the Selected beans list.
- Repeat the previous step until you complete your sequence group. You must add each bean in the order that you want the persistence manager to handle it. In the case of delete operations for an RI_INSERT group, the persistence manager reverses the order that you designate and deletes the beans and their corresponding database rows accordingly. If we need to alter the sequence of your group, select a bean and click the arrow to move the bean one position vertically.
- Save your changes to the deployment descriptor.
- Close the EJB deployment descriptor editor.
- When prompted, click Yes to indicate that you want to save changes to the deployment descriptor.
You also can save changes to deployment descriptors at any time by pressing Ctrl+S.
What to do next
You are now ready to deploy your EJB module or combine it with other modules into a J2EE application.
See Also
Sequence grouping for container-managed persistence
Related Tasks
Deploying and administering applications