Deleting enterprise beans

You can delete enterprise beans, bean classes, access beans, and deployment code. In some cases, you may want to only delete the access beans or deployment code that are associated with enterprise beans.

Note that the packages that are used to hold the generated Java™ types are not deleted with the associated enterprise bean. You must manually delete unused packages from your project when the generated classes in those packages are removed.

You can delete some or all of the artifacts that compose an enterprise bean:

If you delete the EJB metadata from the deployment descriptor, the generated access bean classes and deployment code will also be deleted because they cannot exist without the bean classes. If you delete an enterprise bean using the EJB editor (or while an EJB editor is open), the delete is not committed until the editor is saved. Therefore, if you close the editor without saving, the enterprise bean remains and the deleted Java files are returned.

When an EJB is deleted, all of the metadata that is associated with the bean is also deleted, including metadata from the bindings and extension documents.

Note: When a CMP entity bean is deleted, any mappings related to this bean will not be automatically removed. When the Mapping editor is opened on these files after an entity bean is deleted, the mappings will be removed. This is expected behavior. You will need to open the Mapping editor prior to generating deployment code.

To delete enterprise beans, access beans, or deployment code:

  1. In the Project Explorer view of the J2EE perspective, expand an EJB module and select one or more enterprise beans.
    Tip: You can also delete a bean from the Bean page of the deployment descriptor editor by selecting the bean and clicking Remove. Deleting from the Project Explorer view commits the deletion immediately, if no editor is open. Deleting from the deployment descriptor editor commits the changes when the editor is saved.
  2. In the Outline view, right-click and select Delete Bean(s). A dialog opens and gives you additional options that you can select to further define what you want to delete.
  3. Click OK.

Feedback