Create EJB modulesIn the Assembly Toolkit, you can create and test enterprise beans that conform to the distributed component architecture defined in the Sun Microsystems EJBs specification and that support extended functionality for WAS.
You can create enterprise beans (either with or without inheritance) such as session beans, container-managed persistence (CMP) entity beans, bean-managed persistence (BMP) entity beans, or message-driven beans. Using the EJB deployment descriptor editor of the Assembly Toolkit, you can set deployment descriptor and assembly properties for enterprise beans.
This article describes how to create an EJB project (or EJB module) using the Assembly Toolkit.
- Start the Assembly Toolkit.
- Open the J2EE perspective to work with J2EE projects. Click Window > Open Perspective > Other > J2EE.
- Click File > New > EJB Project.
- In the New EJB Project dialog...
- Select the EJB specification version to which you want your EJB project to adhere, and click Next. If you plan on using EJB 2.0 enterprise beans, specify an EJB 2.0 project. You can add EJB 1.1 enterprise beans to an EJB 2.0 project. An EJB 2.0 project must exist in a J2EE 1.3 enterprise application project. Your available options can differ, depending on the J2EE preferences defined.
- Name the EJB project and specify its location. To change the default project location, click Browse and specify a new location. If you specify a non-default project location that is already being used by another project, the project creation will fail.
- Specify a new or existing enterprise application (EAR) project to be associated with your new EJB project for purposes of deployment. Select an existing enterprise application project from the drop-down list or type a new project name. Or, click New and create a new enterprise application. Note that if you type a new EAR project name, the EAR project will be created in the default location with the lowest compatible J2EE version based on the version of the project being created. If you want to specify a different version or a different location for the enterprise application, click New and create a new enterprise application.
- (Optional) If you are creating a new enterprise application project or if you have no module dependencies to specify, skip this step. Otherwise, click Next to specify module and JAR file dependencies. On the Module Dependencies page, select dependent JAR files or modules within the associated enterprise application project. Note that this page is available only if you are using an existing enterprise application project.
- Click Finish to create the EJB project.
- Verify the contents of the new EJB project in either of the following ways...
- In the J2EE Hierarchy view, expand Enterprise Applications and the enterprise application associated with your EJB project to view the new JAR file.
- Click Window > Show View > Navigator to see the associated files for the EJB project in a Navigator view.
After you have an EJB project to hold enterprise beans, you can do the following...
- Create or import enterprise beans to your EJB project.
- Add methods to the home and remote interfaces.
- Add custom finders.
- Add and define additional CMP fields.
- Add relationships.
- Edit the EJB deployment descriptor if default properties are not sufficient.
- Create EJB access beans and use them to create your client application.
- Map enterprise beans to RDB tables.
For detailed instructions on creating CMP fields or CMP finder methods for entity beans, relating CMP fields, adding methods to interfaces, or managing enterprise beans, see the Assembly Toolkit online help. In the Assembly Toolkit, click Help > Help Contents > Assembly Toolkit information > Enterprise JavaBeans (EJB) development > Tasks. Similar information is in the IBM WebSphere Studio Application Developer InfoCenter at http://publib.boulder.ibm.com/infocenter/wsphelp/index.jsp . Click WebSphere Studio Application Developer > J2EE development > Tasks > Developing EJB applications.
See AlsoEnterprise applications
Assembling EJB modules
Assembling applications with the Assembly Toolkit
Creating enterprise applications