Introduction to Stateful Session Bean In NetBeans30 July 2007
In previous blog Creating J2ee Modules in NetBeans IDE we got the basic knowledge about creating EJB-Module in NetBeans IDE.
Here we will learn to create a stateful session Bean using NetBeans IDE.
- Click on EJB module and select New -> Session Bean, You will see following screen.
- As we are going to create a stateful session bean so select session type as stateful.In create interface option you can select the type of interface you want to generate for your Stateful Session Bean, Select the appropriate option and Click “Finish”.Classes will be generated in IDE.
- Collapse “Enterprise Beans”.You will see Stateful Session Bean added to the IDE. Right Click on bean you can see two option one for create method and other for business method.
- As we are going to code a stateful session bean, Hence we will add a create method first so as we can maintain state of client, Fill the information in IDE,code will be generated in remote interface and Bean class.
- Now we will add Business Methods to the Bean using add option on previous screen. This option will add business methods to bean and remote interface as well.
- After adding create/business methods, you can add/edit Java code for these methods in EJB class in Editor.
- Now your Stateful Bean is completed, you can deploy it using J2ee Container so that you can call it in your application further.
It will look like this: Introduction to Stateful Session Bean In NetBeans