8.3. Session Beans
8.3.1. Session Beans
8.3.2. Stateless Session Beans
8.3.3. Stateful Session Beans
8.3.4. Singleton Session Beans
8.3.5. Add Session Beans to a Project in Red Hat JBoss Developer Studio
- You have a EJB or Dynamic Web Project in Red Hat JBoss Developer Studio to which you want to add one or more session beans.
Procedure 8.5. Add Session Beans to a Project in Red Hat JBoss Developer Studio
Open the ProjectOpen the project in Red Hat JBoss Developer Studio.
Open the "Create EJB 3.x Session Bean" wizardTo open the Create EJB 3.x Session Bean wizard, navigate to the menu, select , and then .
Figure 8.7. Create EJB 3.x Session Bean wizard
Specify class informationSupply the following details:
- ProjectVerify the correct project is selected.
- Source folderThis is the folder that the Java source files will be created in. This should not usually need to be changed.
- PackageSpecify the package that the class belongs to.
- Class nameSpecify the name of the class that will be the session bean.
- SuperclassThe session bean class can inherit from a super class. Specify that here if your session has a super class.
- State typeSpecify the state type of the session bean: stateless, stateful, or singleton.
- Business InterfacesBy 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.
Session Bean Specific InformationYou 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.
FinishClickand 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.
Figure 8.8. New Session Bean in Red Hat JBoss Developer Studio