Monday, September 29, 2008

Internal EJB reference

EJB Hand's On to Clear Concepts

Internal EJB reference

What is ejb-ref:: ejb-link??

The ejb-link element is used in the ejb-ref or ejb-local-ref
elements to specify that an EJB reference is linked to an
enterprise bean. The path name is relative to the war file
containing the web application that is referencing the enterprise bean.
This allows multiple enterprise beans with the same ejb-name to be
uniquely identified.

<ejb-link> is used so that servlets from the same application unit can refer ejb. If we specify <ejb-link> then we don't need to specify any thing in application server specific web.xml file(incase of jboss jboss-web.xml file)

The following example demonstrate the same.


<ejb-ref >
  <description><![CDATA[Reference to the Sidd EJB]]></description>


It say's that Ejb "Sidd" ejb/Sidd refers to the ejb bean named "Sidd" found in MyEJB1.jar in the same ear file.

Note:: Note that the <ejb-ref-name> tags in the 2 xml files must match. 

No comments :

Post a Comment