# New Session Bean Wizard

This wizard creates a new session bean in an EJB module.

You set the following information in the wizard:

Element | Description
--- | ---
EJB Name | Set the name of the session bean. The name is used as the basis for the session bean's class and interface names.
Location | Select the source folder where you want to create the session bean files.
Package | Select an existing package or type the name of a new package.
Session Type | Select one of the following:
Stateless | The bean does not save state information during its conversation with the user. These enterprise beans are useful for simple interactions between client and application service, interactions that are complete in a single method invocation.
Stateful | The bean saves state information during its conversation with the user. These enterprise beans are useful for business processes that require an interaction between client and application service that lasts longer than a single method invocation and requires memory of the state of the interaction. An example is an online shopping cart. The end user, through the client program, can order a number of items. The stateful session bean managing the interaction must accumulate items until the end user is ready to review the accumulated order, approve or reject items, and initiate processing of the lot. The stateful session bean has to store the unprocessed items and enable the end user to add more.
Singleton | (Java EE 6) A singleton session bean is instantiated only once per application and exists for the lifecycle of the application. You can create a singleton bean that the container instantiates when the application starts up by using the @Startup annotation.---An example is a bean that is used to intialize data for an application that can be concurrently accessed by many clients.
Create Interface | Specify which interfaces to create for the session bean:
Local | Allow your session bean to be accessed from clients that are running in the same Java Virtual Machine.
Remote | Allow your session bean to be accessed from remote clients using remote method calls. This usually means clients that are not running on the session bean's application server. If you select Remote, the IDE can generate a remote interface for the session bean in a Java class library project if the project that you want to contain the interface is open in the IDE. You can choose the project from the dropdown list that lists the open Java class library projects.

Related Topics

Developing Applications with NetBeans IDE,

Developing Applications with NetBeans IDE,

Developing Applications with NetBeans IDE,

Copyright © 2016, Oracle and/or its affiliates. All rights reserved.