You can use the Create Session Bean wizard
to create a session bean in your EJB project.
Here are the steps to create a session bean in an EJB project:
- In the Java™ EE perspective, right-click
your EJB Project, and select . The Create Session Bean wizard appears.
- In the Project field, ensure that
your EJB Project name appears.
- In the Folder field, select the
source folder for the new bean.
- In the Java package field, type
the package name for the new bean.
- In the Class name field, type the name that you
want to assign to the session 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.
- In the Superclass field, Browse to
find a Superclass to add to your Session bean.
- In the State Type field, select the type of Session
bean you want to create. Valid options are
- OptionalIn the Create Business Interface field,
select Local or Remote if
you want to include these interfaces.
- Click Next.
- On the Session Bean information page, you may change the
values of some of the Session bean elements:
- Optional: In the EJB Name field,
you can change the value of your EJB name that you assigned in the
previous page.
- Optional: In the Mapped Name field,
type a value for your EJB Mappedname.
- Optional: In the Transaction Type field,
select the type of Session bean you want to create (Container or Bean).
- Optional: In the Business Interfaces field,
you can add or remove Business Interfaces that you created in the
previous wizard page.
- Click Finish.
- In the Java class editor, your new Session
bean appears, with the @Stateless annotation and the required import
statements.