The Java EE 6 Tutorial, Volume I

Accessing Local Enterprise Beans That Implement Business Interfaces

Client access to enterprise beans that implement local business interfaces is accomplished using either dependency injection or JNDI lookup.

Example 14–4 Injecting an Enterprise Bean's Local Business Interface

To obtain a reference to the local business interface of an enterprise bean through dependency injection, use the javax.ejb.EJB annotation and specify the enterprise bean's local business interface name.

Example example;

Example 14–5 Looking Up a Local Enterprise Bean Using JNDI

The obtain a reference to a local business interface of an enterprise bean using JNDI lookup, use the javax.naming.InitialContext interface's lookup method.

ExampleLocal example = (ExampleLocal)