uCosminexus Application Server, API Reference Guide

[Contents][Index][Back][Next]

2.4.9 @EJB

Organization of this subsection
(1) Description
(2) Element

(1) Description

Specify the reference to EJB business interface or home interface. You can specify in a class, method, and field. When specified in a method or field, the annotation becomes a target for Dependency Injection. However, the method must be set method.

(2) Element

The following table lists the elements of @EJB:

Element name Functionality
name Specify the name of resource reference. The specified name is used as a JNDI name. You can omit the element description if the annotation is specified in a method or field.
beanInterface Specify the business interface class or home interface class. You can omit the element description if the annotation is specified in a method or field.
beanName Specify the class name without the EJB package to be referenced. However, when the name element is specified in the annotation (@Stateless, @Stateful) that defines the EJB class to be referenced, specify the name element. Further, in the case of an EJB that supports the definition in DD, specify the value of DD <ejb--name>tag.
mappedName You can specify the element, but you cannot run elements on Cosminexus because Cosminexus does not support elements.
lookup Specify the Portable Global JNDI or the optional name of EJB that is referenced. However, if the beanName attribute or mappedName attributes are specified, settings of beanName attributes or mappedName attributes are preferred.
description Specify the description of the EJB to be referenced.

The details of each element are as follows:

(a) name element

Type
String

Description
Specify the name of resource reference. The specified name is used as a JNDI name. You can omit the element description if the annotation is specified in a method or field.

Default value
  • When set in a method
    Property of the class name or set method in which the annotation is specified
  • When set in a field
    Class name or field name in which the annotation is specified
(b) beanInterface element

Type
Class

Description
Specify the business interface class or home interface class. You can omit the element description if the annotation is specified in a method or field.

Default value
  • When specified in a method
    Argument type of the method
  • When set in a field
    Field type
(c) beanName element

Type
String

Description
Specify a class name without the package of the referenced EJB. However, if the name attribute is specified in an annotation (@Stateless, @Stateful, @Singleton) that defines the EJB class to be referenced, specify the value of the name attribute. For the EJB that supports definition according to DD, specify the value of the <ejb-name> tag of DD.

Default value
""
(d) mappedName element

Type
String

Description
You can specify the element, but you cannot run elements on Cosminexus because Cosminexus does not support elements.

Default value
None
(e) lookup attribute

Type
String

Description
Specify the Portable Global JNDI or the optional name of EJB that is referenced. However, if beanName attributes or mappedName attributes are specified, settings of beanName attributes or mappedName attributes are preferred.

Default value
""
(f) description element

Type
String

Description
Specify the description of the EJB to be referenced.

Default value
""