# Creating session beans

You can use a wizard to create a session bean and add it to your project.

Before you can create an enterprise bean, you must:

- Define an EJB project to contain the enterprise bean. See Creating EJB projects
- Install XDoclet annotation support and enable it. See Configuring XDoclet annotation support

To create a session bean:

1. In the J2EE perspective, click File > New > Other > EJB > Enterprise JavaBean. The Create an Enterprise Bean wizard appears.
2. Select the SessionBean radio button.
3. Click Next.
4. Select the Project that will contain the new session bean.
5. Select a Module Name, or use the New button to create one.
6. In the Folder field, select the folder for the new bean.
7. In the Java package field, enter the package name for the new bean.
8. In the Class name field, type a name for the enterprise bean. By convention, bean names should begin with an uppercase letter.
   Note: You can use Unicode characters for the bean name, but Unicode characters are not supported for enterprise bean packages and classes associated with enterprise beans.
9. Change the Superclass for the bean if you want it to inherit from a class other than `java.lang.Object`.
10. Click Next.
11. Provide an EJB Name for the bean. This is the name of the enterprise bean class.
12. Provide an JNDI Name for the bean. This is a logical name used by the server to locate an enterprise bean at runtime.
13. Provide an Display Name for the bean. This is a short name for the enterprise bean that is used by tools.
14. Provide a text Description for the bean.
15. Select the State type for the new bean:
    - A Stateful session bean maintains client-specific session information, or conversational state, across multiple method calls and transactions. An instance of a stateful session bean has a unique identity that is assigned by the container at create time.
    - A Stateless session bean does not maintain conversational state. Instances of a stateless session bean have no conversational state. All instances of a stateless session bean have the same object identifier, which is assigned by the container.
16. Select a Transaction Type for the new bean:
    - Container specifies that the transaction demarcation is performed by the container.
    - Bean specifies that the transaction demarcation is performed by the bean.
17. Click Next.
18. Select the type of Modifiers to use for the class. Choices are Public, Abstract, and Final.
19. Select the Interfaces you want the bean to implement:
    - Click the Add button to open the Type Selection dialog box where you can select the interface that you want to implement.
    - If you added an interface that you no longer want to implement, select the interface in the list and click Remove.
20. Select the method stubs that you want the wizard to create. Choices include main, Inherited abstract methods, and Constructors from the superclass.
21. Click Finish. The new bean is added to the specified EJB project.

(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.