# @ejbgen:resource-env-ref Annotation

This tag maps a JNDI reference used within a bean to an administered object associated with an external resource. Common examples of such connection factories are (JMS) javax.jms.Queue and (JMS) javax.jms.Topic.

## Scope

Class tag on all EJBs.

## Syntax

@ejbgen:resource-env-ref

[id="TagID"]

[jndi-name="JNDIName"]

name="ReferenceName"

type="ObjectType"

## Attributes

id

Optional. Specifies the ID of the tag. For more information, see EJBGen Tag Inheritance.

jndi-name

Optional. Specifies the JNDI Name of the administered object.

name

Required. Specifies the name of the reference to the administered object as used in the bean definition.

type

Required. Specifies the type of the resource. Examples are javax.jms.Queue, and javax.jms.Topic.

## Remarks

The ejbgen:resource-env-ref tag is used in conjunction with the ejbgen:resource-ref tag. The latter tag maps the external resource used while the ejbgen:resource-env-ref tag maps any administered object associated with that queue. For example, the ejbgen:resource-ref tag maps a reference to a javax.jms.TopicConnectionFactory, while the ejbgen:resource-env-ref tag maps to javax.jms.Topic.

For a code example, see the @ejbgen:resource-ref tag or Step 12 of Tutorial: Enterprise JavaBeans.

Related Topics

@ejbgen:resource-ref Annotation

Tutorial: Enterprise JavaBeans