Creating EJB projects

You can use wizards to create an EJB module in your Java EE project.

To create a new EJB project:

  1. In the Java™ EE perspective, select

    File | New | Other | EJB Project. The New EJB Project wizard opens.

  2. In the

    Name field, type a name for the EJB project. To change the default

    Project location, click the Browse button to select a new location. If you specify a non-default project location that is already being used by another project, the project creation will fail.

  3. In the

    Target runtime drop-down list, select the server that you want to target for your development. Or, create a new target runtime environment by clicking

    New. The target runtime selection affects the compilation and runtime settings by modifying the class path entries for the project. To create an EJB 3.0 project, select WebSphere® application server V7.0 or WebSphere application server V6.1 with the feature Pack for EJB 3.0 installed.

    Note: If your workspace contains any EAR projects, the name of this EAR may appear in the

    EAR membership field at the bottom of the page, because the tools reference an existing EAR by default. In this case, the

    Target runtime field appears disabled, because its value reflects the target runtime of the EAR that appears by default. If you select another existing EAR in the

    EAR Project Name field, the target runtime will refresh. If you create a new EAR by typing a new name in the

    EAR Project Name field, then the

    Target runtime field is enabled and you can choose a target runtime.

  4. Optional:

    Select a pre-defined project configuration from the

    Configurations drop-down list.

  5. Optional:

    Modify Configuration, especially for Entity Bean creation: If you want to modify the configuration details, click

    modify:

    If you plan to create JPA entities in the EJB 3.0 project, for example, select

    Java Persistence. Save this configuration with a meaningful name, for example, EJBDevelopmentWithJPA so that you can reference this configuration in any EJB 3.0 projects that are subsequently created.

  6. Optional:

    Select the

    Add project to an EAR module check box to add the new module to an enterprise module (EAR) project. Type a new project name or select an existing enterprise module project from the drop-down list in the

    EAR Project Name combination box. Or, click

    New to launch the New EAR module Project wizard.

  7. In the

    Source Folder field, specify a folder for your source files or accept the default value.

  8. Optional:

    Select

    Create an EJB Client JAR module to hold the client interfaces and classes if you want the client interface classes for your enterprise beans to be kept in a separate EJB client JAR file. This EJB client JAR file will be added to the enterprise module as a project utility JAR file. Specify values for the

    Name and

    Client JAR URI fields, or accept the defaults.

  9. Optional:

    Select

    Generate Deployment Descriptor if you want to create a deployment descriptor, although the deployment descriptor is not required in EJB 3.0. The deployment descriptor stores information relating to the EJB project in an Extensible Markup Language (XML) file, serving three functions:

    • Declaring the contents of the module

    • Defining the structure and external dependencies of the beans in the module

    • Describing how the enterprise beans are to be used at run time
    You can add a deployment descriptor later, if you do not add it during the project creation. For information on adding a deployment descriptor file, see Generating deployment descriptors.

  10. Click Finish.

 

Related concepts

Developing EJB 3.0 Applications

Differences between EJB 3.0 and EJB 2.1

EJB modules

Editing EJB 3.0 applications

Securing enterprise applications

Testing EJB 3.0 applications

Deploying EJB 3.0 applications

Creating enterprise beans