Pramati Technologies

Managing Container Managed Relationships in Pramati Studio

Overview

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.

Starting 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.

Note: In case of Self bi-directional relationships, Pramati Server supports only One-to-many relationships.

Using Relationship Manager

Table 1:
Attribute
Description
Module Name
Select from the available modules in the active desk to start working with the CMRs
Bean Name Filter
Select a bean name from the dropdown to view relationships defined using the bean. Selecting Show All displays all relationships that exist in the module; Show All is selected by default. Existing relationships are displayed in the lower half of the panel
Source
Displays the source bean name in the relationship
Relation
Displays the nature of relation existing between two beans. The relation is defined by multiplicity and navigability
Target
Displays the target bean name in a relationship. If there for a relationship the target EJBName does not exist, target EJBName is displayed in red. On selecting this row, Add, Delete, and Modify options are enabled and Revert is disabled
Join
Click the icon to open Join Condition dialog. Define the Join conditions here

Adding new relationships

Click Add to define a new relationship.

Table 2:
Attribute
Description
Source
Select a source bean using the dropdown
Relation
Select the type of relationship to be defined between source and target beans
Target
Select a target bean using the dropdown

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.

Deleting relationships

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.

Modifying existing relationships

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.

Note: Rows marked for deletion cannot be modified, and selecting such a row disables Modify. For such relationships, select the row, click Revert, and click Modify.

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.

Notes: Before using Relationship Manager, ensure that all source files involving source code modifications are in a parseable state, are not open in the editor, or being used by other programs.

Reverting commands

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   TOCPREVNEXTINDEX