Java Reference
In-Depth Information
If our bean had both a local and remote interface, we would have been given the
choice to select the appropriate one. However, since it only has a remote interface,
the option to select a local interface is disabled. In our particular example, even if we
had the option of selecting a local interface, the correct option would have been to
select the remote interface. This is because our client will be executing in a different
JVM from the server, and local interfaces are not accessible across JVMs.
At this point, a member variable of type EchoRemote (our bean's remote interface)
is added to the client; this variable is annotated with the @EJB annotation. This
annotation is used to inject the instance of the remote interface at runtime.
In previous versions of J2EE, it was necessary to perform a
JNDI lookup to obtain a reference to the home interface of the
bean, and then use the home interface to obtain a reference
to the remote or local interface. As we can see, the procedure
to obtain a reference to an EJB has been greatly simplified in
Java EE.
The generated code shown in the following screenshot:
 
Search WWH ::




Custom Search