Defining sequence groups for CMP Entity Beans

By designating CMP sequence groups for entity beans, you can prevent certain types of database-related exceptions from occurring during the run time of your EJB application.

Before you begin

Within each group, you specify the order in which the beans update your relational database tables.

About this task

Both types of sequence groups must be created after you have assembled the beans into an EJB module, before installing your application on the product. If you need to edit sequence groups, you must 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

  1. Switch to the Java™ EE perspective.
  2. In the Enterprise Explorer view, select the desired EJB module.
  3. Right click the deployment descriptor, and select Open With > Deployment Descriptor Editor.
  4. On the Overview page of the editor, go to the EJB CMP Sequence Groups section under the WebSphere® Extensions section.
  5. Click Add.
  6. Type a name for your sequence group.
  7. select one of the following values from the list for the group type designation
    • 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 Why and when to perform this task.
  8. 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 you need to alter the sequence of your group, select a bean and click the arrow to move the bean one position vertically.
  9. Close the EJB deployment descriptor editor.
  10. When prompted, click Yes to indicate that you want to save changes to the deployment descriptor.

What to do next

See the WebSphere Application Server documentation for more detailed information about Sequence Groups for CMP Entity Beans.


Feedback