You can use the EJB deployment descriptor editor to add and remove
client views, or interfaces, from existing entity or session beans.
Client views are either local or remote, and entity and session
beans must contain at least one client view. EJB 2.x beans can include both
local and remote client views, while EJB 1.1 beans only include the default
remote client view. Message-driven beans do not contain client interfaces.
EJB 2.1 stateless session beans can also include a Web service client view.
For
example, if an existing EJB 2.0 BMP entity bean includes local and local home
interface (a local client view), you can use the deployment descriptor editor
to add remote and remote home interfaces. When you add the interfaces, you
have the option of copying the methods from the existing local interfaces
to the new remote interfaces. You also can choose to delete the existing local
interfaces at the same time as the addition of the remote interfaces.
Because
EJB 1.1 beans only contain a remote interface, you cannot add an additional
client view or remove the existing client view from an EJB 1.1 bean.
To
add a client view to an EJB 2.x enterprise bean:
- In the Project Explorer view of the J2EE perspective, right-click
the Deployment Descriptor for your EJB project and select to
open the deployment descriptor editor.
- On the Beans page of the editor, select
the entity or session bean that you want to work with.
- In the Class and Interface files section, click Add.
- In the Add Client View wizard, select a check box in the Add
new interfaces section to specify the type of client view that
you want to add. Depending on the interfaces that exist, only the appropriate
check boxes will be available.
- In the Add methods from an existing interface to the
new client view section, select whether you want to copy the methods
from the existing interfaces. This option is not available if there are no
existing interfaces.
- In the Remove and/or delete the existing client view section,
select whether you also want to simultaneously delete the existing client
view from the bean, from the project, or from both.
- Click Next.
- Select the desired Package and Class for
each interface.
- Click Finish.
If you decide that your bean does not need a particular client view,
you can remove it from the bean, if the client view is not required. To remove
a client view after you add it, select the client view in the Class and Interface
files section and click Remove. The Remove Client View
wizard helps you complete the removal.