This section describes how to set up an optional name for Enterprise Beans.
You can set up an optional name for the Enterprise Beans using the following methods:
This subsection describes the respective methods.
Note that when you use this functionality, you must first specify whether you want to use the optional name, in usrconf.properties of the server management commands. For details on the settings, see 2.6.7 Execution environment settings.
To set up the optional name for an Enterprise Bean, you specify the settings in the <ejb-jar> tag of cosminexus.xml. The following table describes the optional name settings for the Enterprise Beans in cosminexus.xml.
Table 2-25 Setting the optional names for the Enterprise Beans in cosminexus.xml
Items | Specified tags | Settings |
---|---|---|
Remote interface | <session> - <optional-name> tag | Specifies the optional name for the remote interface of the Session Bean. |
<entity> - <optional-name> tag | Specifies the optional name for the remote interface of the Entity Bean. | |
Local interface | <session> - <local-optional-name> tag | Specifies the optional name for the local interface of the Session Bean. |
<entity> - <local-optional-name> tag | Specifies the optional name for the local interface of the Entity Bean. |
For details on the specified tags, see 2.2 Details of attributes specified in the Cosminexus application property file (cosminexus.xml) in the uCosminexus Application Server Application and Resource Definition Reference Guide.
You specify the optional name in the mappedName attribute of @Stateless, @Stateful, or @Singleton.
The following is an example of coding when the optional name is specified using annotations. In this example, the optional name "MyFoo" of the Stateless Session Bean is specified in the mappedName attribute of @Stateless.
@Stateless(mappedName="MyFoo") |
The optional name specified in the mappedName attribute of @Stateless, @Stateful, or @Singleton is set up in the <hitachi-session-bean-property><mapped-name> tag of the Session Bean property file.
If the optional name is specified by specifying the mappedName attribute of @Stateless, @Stateful, or @Singleton, and if the optional name is specified in the <optional-name> tag or <local-optional-name> tag in cosminexus.xml, the specification in the <optional-name> tag and <local-optional-name> tag becomes valid.
The following table lists the tags that become valid when the optional name is specified in both server management commands and annotations.
Table 2-26 Tags that become valid when the optional name is specified in both server management commands and annotations
Target for setting up the optional name | Only the mappedName attribute of @Stateless, @Stateful, or @Singleton is specified | Only the <optional-name> tag or <local-optional-name> tag is specified | When both mappedName attribute of @Stateless, @Stateful, or @Singleton, and the <optional-name> tag or <local-optional-name> tag are specified |
---|---|---|---|
Remote interface | <mapped-name> tag # | <optional-name> tag | <optional-name> tag |
Local interface | <mapped-name> tag # | <local-optional-name> tag | <local-optional-name> tag |
#: The tag in which the value specified in the mappedName attribute of @Stateless, @Stateful, or @Singleton is set up.