What is therelationship between @EJB and ejb-ref/ejb-local-ref?
http://glassfish.java.net/javaee5/ejb/EJB_FAQ.html
What is therelationship between
The@EJB annotationand the ejb-ref/ejb-local-ref .xmlelements
are used to specify the same semantic information. Specifically, that a Java EE component has adependency on a local or remote EJB component. Every @EJB canbe
translated into an equivalent ejb-ref/ejb-local-ref. @EJB iseasier
to use but it serves the same purposeas ejb-ref/ejb-local-ref.
Here's a table with more details :
What is therelationship between @EJB and ejb-ref/ejb-local-ref?
The
@EJB |
Description |
Default value |
ejb-refequivalent |
ejb-local-refequivalent |
name |
Unique location within the private component namespace(java:comp/env). |
field-level : method-level : class level : |
ejb-ref-name |
ejb-ref-name |
beanInterface |
For EJB 3.x business interfaces, the Local or Remote businessinterface of the session bean. For EJB 2.x, the Home/LocalHome interface of the session/entitybean. |
field-level : the type of the declared field. method-level : the type of the single setter parameter class level : |
For EJB 3.x :<remote> For EJB 2.x : <home> |
For EJB 3.x : <local> For EJB 2.x : <local-home> |
beanName |
ejb-name |
Automatically resolved if there is only one EJB component withinthe application that exposes |
ejb-link |
ejb-link |
lookup *(Added in EJB 3.1) |
Specifies the portable |
n/a |
lookup-name |
lookup-name |
mappedName |
Specifies the product-specific name of the target Remote EJBcomponent. Not applicable for local interfacesbecause *(Should not be used in EJB 3.1. |
If the target EJB component is defined within the same applicationand the Otherwise, the target global |
mapped-name |
n/a |