Top Description Methods
javax.ejb

public @Interface EJB

extends Annotation
Annotations
@Target:TYPE, METHOD, FIELD
@Retention:RUNTIME
Imports
java.lang.annotation.Target, .Retention

Indicates a dependency on the local, no-interface, or remote view of an Enterprise JavaBean.

Either the beanName or the lookup element can be used to resolve the EJB dependency to its target session bean component. It is an error to specify values for both beanName and lookup.

If no explicit linking information is provided and there is only one session bean within the same application that exposes the matching client view type, by default the EJB dependency resolves to that session bean.

Since
EJB 3.0

Method Summary

Modifier and TypeMethod and Description
public Class<T>
beanInterface()

The interface type of the Enterprise Java Bean to which this reference is mapped.

public String
beanName()

The beanName element references the value of the name element of the Stateful or Stateless annotation, whether defaulted or explicit.

public String
description()

A string describing the bean.

public String
lookup()

A portable lookup string containing the JNDI name for the target EJB component.

public String
mappedName()

The product specific name of the EJB component to which this ejb reference should be mapped.

public String
name()

The logical name of the ejb reference within the declaring component's (e.g., java:comp/env) environment.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

beanInterfaceback to summary
public Class<T> beanInterface()

The interface type of the Enterprise Java Bean to which this reference is mapped.

Holds one of the following types of the target EJB :

  • Local business interface
  • Bean class (for no-interface view)
  • Remote business interface
  • Local Home interface
  • Remote Home interface
beanNameback to summary
public String beanName()

The beanName element references the value of the name element of the Stateful or Stateless annotation, whether defaulted or explicit. If the deployment descriptor was used to define the name of the bean, the beanName element references the ejb-name element of the bean definition.

The beanName element allows disambiguation if multiple session beans in the ejb-jar implement the same interface.

In order to reference a bean in another ejb-jar file in the same application, the beanName may be composed of a path name specifying the ejb-jar containing the referenced bean with the bean name of the target bean appended and separated from the path name by #. The path name is relative to the jar file containing the component that is referencing the target bean.

Only applicable if the target EJB is defined within the same application or stand-alone module as the declaring component.

descriptionback to summary
public String description()

A string describing the bean.

lookupback to summary
public String lookup()

A portable lookup string containing the JNDI name for the target EJB component.

Since
EJB 3.1
mappedNameback to summary
public String mappedName()

The product specific name of the EJB component to which this ejb reference should be mapped. This mapped name is often a global JNDI name, but may be a name of any form.

Application servers are not required to support any particular form or type of mapped name, nor the ability to use mapped names. The mapped name is product-dependent and often installation-dependent. No use of a mapped name is portable.

nameback to summary
public String name()

The logical name of the ejb reference within the declaring component's (e.g., java:comp/env) environment.