Deleting enterprise beans

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

About this task

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 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 are also 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 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 are not 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 need to open the Mapping editor before generating deployment code.

Procedure

  1. In the Enterprise Explorer view of the Java EE 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 Enterprise 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. The associated WebSphere® bindings and extensions are also removed as part of the delete refactoring process.
  3. Click OK.

Feedback