Step 1: Adding a Local Reference

Previous topic
Previous
Next topic
Next

Adding a local reference is easy to do using the UML tools. You select the type of reference you want to create, and draw a line between the two beans.

To add a local reference:

  1. In the Component Palette, choose EJB Local Reference. (If the Component Palette is not visible, from the View menu choose Component Palette.)
  2. In the UML diagram, click on the session bean (hrApp) and drag to the entity bean (Dept).

    The local reference is displayed as a line between hrApp and Dept.

The local ref that you created in the UML diagram is also reflected in the deployment descriptor and bean class. Take a look at this now.

To view the deployment descriptor code:

  1. In the Navigator, double click ejb-jar.xml.
    The file opens in the Code Editor.
  2. Scroll through the code and find the local ref that was generated.

To view the bean class code:

  1. In the Navigator, double click the bean class (hrAppBean.java) to open it in the Code Editor.
  2. In the Structure pane, double click getDeptLocalHome() to jump to that method.
    Notice that the method is generated for you.