Defining Interfaces and Classes for EJBs

An EJB comprises a number of specific interfaces and implementation classes. Interfaces of an EJB are always exposed, you define a public interface and expose it. You can attach an interface or class to only one EJB at a time.

EJB component interfaces are shown as circles linked to the EJB component side by an horizontal or a vertical line:



Interfaces provide a remote view (Remote home interface Remote interface), or a local view (Local home interface Local interface).

Classes have no symbol in the component diagram, but the relationship between the class and the EJB component is visible from the Classes page of the EJB component property sheet, and from the Components tabbed page in the Dependencies page of the class property sheet.

The following table displays the stereotypes used to automatically identify EJB interfaces and classes:

Stereotype

Describes

<<EJBRemoteHome>>

The remote home interface

<<EJBRemote>>

The remote interface

<<EJBLocalHome>>

The local home interface

<<EJBLocal>>

The local interface

<<EJBEntity>>

The bean class of an entity bean

<<EJBSession>>

The bean class of a session bean

<<EJBMessageDriven>>

The bean class of a message driven bean

<<EJBPrimaryKey>>

The primary key class of an entity bean

Template names are instantiated with respect to the corresponding component and assigned to the newly created objects. If an unattached interface or class, matching a given name and classifier type already exists in the model, it is automatically attached to the EJB.

  1. Right-click the EJB component in the diagram and select EJB from the contextual menu.

    The component property sheet opens to the EJB page. Interfaces and classes are created and attached to the EJB.



    You can use the Create tool beside the interface or the class name to recreate an interface or a class if it is set to <None>.

  2. Click the Properties button beside the interface or the class name box that you want to define.

    The interface or the class property sheet is displayed.

  3. Select properties as required.

    The interfaces and classes definitions are added to the current EJB component definition.