When is the best time to use <ejb-link>? Do I have to use it everytime I want to make a reference from an EJB to another EJB?
<session> ... <ejb-ref> <ejb-ref-name>ejbAddress</ejb-ref-name> <ejb-ref-type>Entity</ejb-ref-type> <home>AddressHome</home> <remote>Address</remote> <ejb-link>AddressEJB</ejb-link> </ejb-ref> ... </session> <entity> <ejb-name>AddressEJB</ejb-name> <ejb-class>AddressBean</ejb-class> <home>AddressHome</home> <remote>Address</remote> ... </entity>] No - you don't have to use ejb-link every time you reference an enterprise bean component. It allows an Application Assembler to reference an EJB by name without the need to have unique names for all beans by constantly renaming them for the J2EE application. And, ofcourse, such cannot be guaranteed if one buys third-party bean components.
The example you have shown is one way that assumes the reference's EJB is in the same ejb-jar file as the referencing bean. The other way is to use a path-name
The Deployer is then responsible for binding the ejb-link references to the home of the target bean.