There is no
<ejb-local-ref> in the above example. Instead, it uses the
global JNDI name to lookup the bean's local interface. In a WebSphere AS, the default global JNDI name of an EJB 3.0 local interface is
ejblocal:fully_qualified_classname.
The following helper method performs the global JNDI lookup, hiding the naming convention from client code:
It is used without type-cast in the following manner:
This is the most convenient way to lookup an EJB 3.0 from within EJB 2.1 code. However, it makes use of a proprietary naming convention. If you don't like this, or if you insist on using solely the environment naming context ("java:comp/env") for all lookups, you are in fact required to
ad hoc define
within your EJB 3.0 two additional EJB-2.1-like interfaces: (1) a local object, i.e. an interface extending
javax.ejb.EJBLocalObject (not to be confused with the EJB3 local business interface), and (2) a local home, i.e. an interface extending
javax.ejb.EJBLocalHome, specifying a standard
create() method. These interfaces must then be referenced in the mandatory
<local> and
<local-home> sub-elements of the
<ejb-local-ref> within your EJB 2.1 component.