IntelliJ IDEA 2017.2 Help

Creating EJB

This feature is supported in the Ultimate edition only.

IntelliJ IDEA provides the following ways to create beans:

  • Manually, by means of direct editing the ejb-jar.xml file, using the extensive coding assistance provided by IntelliJ IDEA.
  • Using the context menu commands.

To create an Enterprise Java bean using the editor

  1. Open the deployment descriptor file ejb-jar.xml for editing.
  2. Create the <enterprise-beans> section.
  3. In this section, create tags for the desired bean types: <session>, <entity>, or <message-driven >
  4. Specify the bean name and class by adding tags <ejb-name>. and <ejb-class>. Note that you can specify the target package in this tag, for example, samples.ejb.ManuallyCreatedEntity, using code completion after each dot.
  5. If the declared class does not yet exist, IntelliJ IDEA suggests a quick fix:
    createEjb1.png

    Choose Create Class <class name> from the suggestion list. If the target package was not defined in the <ejb-class> tag, select the desired package in the Choose Destination Directory dialog box. The stub class is created in the specified location.

  6. Proceed with defining the other bean components.
  1. Open the EJB tool window.
  2. Right-click the desired module, choose New on the context menu, and then select the bean type on the submenu.

    The New <bean type> Bean dialog box opens.

  3. Specify the bean name, class and package.
  4. Define the bean-specific settings:
Last modified: 29 November 2017

See Also