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:
- In the Component Palette, choose EJB Local Reference.
(If the Component Palette is not visible, from the View
menu choose Component Palette.)
- 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:
- In the Navigator, double click ejb-jar.xml.
The file opens in the Code Editor.
- Scroll through the code and find the local ref that was generated.
To view the bean class code:
- In the Navigator, double click the bean class (hrAppBean.java)
to open it in the Code Editor.
- In the Structure pane, double click getDeptLocalHome()
to jump to that method.
Notice that the method is generated for you.
