Step 2: Creating a Session Bean

Previous topic
Previous
Next topic
Next

The first EJB you will create is a stateless session bean. This bean represents a single session in your application. This session bean will also be used to implement the Session Facade design pattern.

To create a session bean with the modeler:

  1. In the Navigator, right click your project (EJB-Tier.jpr) and choose New UML Diagram.
  2. In the New dialog, select Class Diagram and click OK.
  3. In the Create New Class Diagram dialog, change the Name to hr_class_diagram and click OK.
  4. In the Component Palette, choose EJB from the drop-down list. (If the Component Palette is not visible, from the View menu choose Component Palette.)
  5. In the Component Palette, click Session Bean to create a new session bean.
  6. In the class diagram (the empty window), click in one corner and drag towards the opposite corner to draw a session bean on the class diagram.
    The Enterprise JavaBean Wizard opens.
  7. Review the information on the Welcome page and then click Next.
  8. On the Select EJB Version page, chose the default (Enterprise JavaBeans 2.0) and click Next.
  9. On the EJB Name and Options page, enter a hrApp in the EJB Name field.
    Notice the Session Type is Stateless. Accept this as the default and click Next.
  10. On the Class Definitions page you can accept the defaults and click Next.
  11. On the EJB Home and Component Interfaces page, select the checkboxes for both Include Remote Interfaces and Include Local Interfaces.
  12. Click Next.
  13. On the Summary page, review the choices you have made. Click Finish.
    Your session bean is added to the UML diagram.