7.3.5. Add Session Beans to a Project in JBoss Developer Studio

JBoss Developer Studio has several wizards that can be used to quickly create enterprise bean classes. The following procedure shows how to use the JBoss Developer Studio wizards to add a session bean to a project.

Prerequisites:

  • You have a EJB or Dynamic Web Project in JBoss Developer Studio to which you want to add one or more session beans.

Procedure 7.5. Add Session Beans to a Project in JBoss Developer Studio

  1. Open the Project

    Open the project in JBoss Developer Studio.
  2. Open the "Create EJB 3.x Session Bean" wizard

    To open the Create EJB 3.x Session Bean wizard, navigate to the File menu, select New, and then Session Bean (EJB 3.x).
    Create EJB 3.x Session Bean wizard

    Figure 7.7. Create EJB 3.x Session Bean wizard

  3. Specify class information

    Supply the following details:
    • Project
      Verify the correct project is selected.
    • Source folder
      This is the folder that the Java source files will be created in. This should not usually need to be changed.
    • Package
      Specify the package that the class belongs to.
    • Class name
      Specify the name of the class that will be the session bean.
    • Superclass
      The session bean class can inherit from a super class. Specify that here if your session has a super class.
    • State type
      Specify the state type of the session bean: stateless, stateful, or singleton.
    • Business Interfaces
      By default the No-interface box is checked so no interfaces will be created. Check the boxes for the interfaces you wish to define and adjust the names if necessary.
      Remember that enterprise beans in a web archive (WAR) only support EJB 3.1 Lite and this does not include remote business interfaces.
    Click Next.
  4. Session Bean Specific Information

    You can enter in additional information here to further customize the session bean. It is not required to change any of the information here.
    Items that you can change are:
    • Bean name.
    • Mapped name.
    • Transaction type (Container managed or Bean managed).
    • Additional interfaces can be supplied that the bean must implement.
    • You can also specify EJB 2.x Home and Component interfaces if required.
  5. Finish

    Click Finish and the new session bean will be created and added to the project. The files for any new business interfaces will also be created if they were specified.
RESULT: A new session bean is added to the project.
New Session Bean in JBoss Developer Studio

Figure 7.8. New Session Bean in JBoss Developer Studio