![]() |
Entity beans with Container Managed Persistence(CMP) version 2.0 may have relationships with each other. The multiplicity of relationship between two beans can be one-to-one, one-to-many, or many-to-many. Studio provides a Relationship Manager, which enables to define new relationships or modify existing relationships after a bean is created.
This document describes how to manage relationships and simplify the process of building and managing such components using the Relationship Manager.
Select Tools > Relationship Manager from the main menu to open Relationship Manager. The panel appears only when current desk contains a EJB 2.0 module with CMP 2.0 beans.
Use Relationship Manager to define new relationships, modify, and delete existing relationships between beans in the same module. Studio supports a bean having relationship with itself.
Click Add to define a new relationship.
Source and Target EJB names available in the dropdown contain only those EJBNames that can participate in the relationship. Only CMP 2.0 beans that have Local interfaces can have relationships. If a CMR name already in use is typed, a message informing that the CMR is in use with a bean, appears. The CMR name is displayed in red and OK button is disabled. OK button is enabled when all information is provided appropriately. Clicking OK makes the relationship row appear in green color. Click Cancel to ignore all modifications and revert to the Relationship Manager. When additions are done, Undo option appears that allows to revert to the last saved changes source code. Click Close to save the relationship information.
Select an existing relationship row and click Delete. Close Relationship Manager to save the change. Relationships added after opening Relationship Manager are immediately removed on clicking Delete.
To modify, select a relationship and click Modify. This opens Modify Relationship panel.
In the Modify Relationship dialog, the Source and Target EJB Names cannot be modified. When an invalid relationship is selected for modification, only Target EJBName is displayed as an option and is editable. The Source EJBName remains un-editable.
Clicking OK displays modifications details in a text area. The details are also logged in a file under desk folder. The file name is suffixed with a time stamp. Click Cancel to ignore modifications and to revert to the Relationship Manager. Cancel option changes to Undo when modifications are complete; click Undo to cancel all changes made to the source code. Click Close to compile modified sources and save the new relationship in the beans. Relationship Manager changes the signatures of get/set methods of the bean class and its Local interface. All references to these methods should be changed manually. Compilation performed after modifications may give errors.
Revert command in Relationship Manager cancels a Delete or Modify command. It is enabled only when the selected row has been marked for modification or deletion. Before trying to revert a relationship, ensure that the original state is valid. For example, old CMR names are not being used by other relationships. Click OK to revert.
| Pramati Technologies © Copyright |
|