Add Relationship

Enterprise bean -> Relationships tabbed pane -> Add button

The Add Relationship dialog box allows you to define the container-managed relationships between entity beans in the application.

The EJB A panel contains the names of EJBs whose relationships are being defined. The EJB B panel contains the names of the EJBs being related to the EJB A item. The reference of each to the other (if any) is in the Field Referencing Bean B and Field Referencing Bean A columns. The nature of the relationship, e.g. one to many, is given in the Multiplicity list.

The EJB name fields are drop-down lists containing known entity EJBs in the JAR. Listed EJBs may be selected for defining or editing relationships. When an EJB has been selected, the bean will be introspected and its container-managed reference (CMR) fields will be listed in the Field Referencing Bean X field.

The Multiplicity drop-down list allows the choice of the nature of the relationship from the following:

When Adding the names of the beans and their relationships, references must be filled in.

The Delete When Bean X is Deleted boxes are for marking what happens to the bean when the other EJB is deleted define the "Cascade Delete" behavior of a bean in the relationship. The box is disabled if the other bean is not a bean in the relationship. When the box is checked the bean is deleted whenever the other bean is deleted.

Click OK to bring back the Container Managed Relationships pane with the new relationship showing as a row in the table.

An EJB must have local interfaces defined before it can be referenced by a CMR field of another bean. On OK an error dialog is presented when a CMR field references an EJB for which local interfaces have not been defined.

To remove a relationship, select a row from the table and click Delete.


Legal Notices