EJB Module Tasks: Quick Reference

This topic describes common tasks you can perform with EJB modules. For more detailed information, click the links in the right column.

To perform this task Follow these steps
Create an EJB module project.
  1. Choose File > New Project (Ctrl-Shift-N).
  2. Select the right template from the Java EE category.
Create an enterprise bean.
  1. Select the project node for any EJB module project.
  2. Choose File > New (Ctrl-N).
  3. Select an enterprise bean template from the Enterprise category.
Generate CMP entity beans from a database.
Build an EJB module.
  • If the module is part of an enterprise application, right-click the enterprise application project and choose Build.
  • If the module is a stand-alone EJB module, right-click the EJB module project and choose Build.
Package a JAR file on an EJB module's classpath in the EJB JAR file.
  1. Right-click the EJB project's node and choose Properties.
  2. Click Libraries in the left panel of the dialog box.
  3. Select the checkbox in the Package column for the classpath item.
Verify an EJB module.
Deploy an EJB module.
  • If the module is part of an enterprise application, right-click the enterprise application project and choose Run .
  • If the module is a stand-alone EJB module, right-click the EJB module project and choose Run.
Generate a reference to an enterprise bean.
  1. Open any Java class file from an EJB module project or web application project.
  2. Right-click anywhere inside the class file and choose Insert Code > Call Enterprise Bean.
Add an EJB module to an enterprise application.
Edit an EJB module's deployment descriptors.
  1. Expand Configuration Files node for the EJB module project.
  2. Double-click the deployment descriptor.
Add or remove local and remote interfaces.
  1. Expand Configuration Files node for the EJB module project.
  2. Double-click ejb-jar.xml to open the deployment descriptor in a visual editor.
  3. Expand the Enterprise Bean Implementation and Interfaces section for the enterprise bean.
  4. Select or unselect the checkbox for the appropriate interface.
Add a business method to an enterprise bean.
  1. Open the bean class for the enterprise bean in the Source Editor.
  2. Right-click in the bean class and choose Insert Code > Add Business Method.
Add a method to an interface.
  1. Click the hint in the left margin next to the line containing the method in the Source Editor and choose an interface from the popup menu.
Debug an EJB module.
  • If the module is part of an enterprise application, right-click the enterprise application project and choose Debug .
  • If the module is a stand-alone EJB module, right-click the EJB module project and choose Debug.
Repackage an existing EJB JAR file for deployment on a different application server.
  1. Create a Packaged Archive project based on the existing EJB JAR file.
  2. In the new project, modify the appropriate configuration files and create any necessary server-specific files.

Legal Notices