> I am struggling to understand EJBs, basically I have got an EJB called
> Stateless2 and the following source files...
[quoted text clipped - 13 lines]
> to these objects go to the network layer (even if the EJB and servlet
> are in the same JVM) and so are relatively inefficient.
They may or may not actually go to the network layer, but they do obey
the semantics for remote method invocations. Among other things, those
semantics involve creating copies of all the outbound arguments and the
inbound return values.
> ...thats where the (local) Home and (local) object interfaces comes
> in, they work in the same way, but make local calls and so are more
> efficient.
As you say, local method invocations are more efficient in every J2EE
implementation I have any knowledge of. This is in part because they
have standard Java method invocation semantics (specifically, reference
passing semantics).
> The problem is that I cant figure out how to call them! Do I just do a
> JNDI lookup for it, if so then what is the reference?
You do a JNDI lookup for the EJBLocalHome object, and use it to obtain
an EJBLocalObject instance. This works very much the same as a remote
EJB lookup, although you are not required to use
PortableRemoteObject.narrow() on the EJB instance (but you may do if you
want to). The JNDI name to which the local home object is bound is
configured with the rest of the bean's deployment information, much the
same way that the name of the [remote] home object is configured.
John Bollinger
jobollin@indiana.edu
Henrik Sjostrand - 03 Aug 2004 21:53 GMT
> > I am struggling to understand EJBs, basically I have got an EJB called
> > Stateless2 and the following source files...
[snip]
> > The problem is that I cant figure out how to call them! Do I just do a
> > JNDI lookup for it, if so then what is the reference?
[quoted text clipped - 9 lines]
> John Bollinger
> jobollin@indiana.edu
You need to set up an EJB reference to find your EJB's Local Home
Interfaces. Take a look in the EJB 2.0 Redbook for details on how to
do it (it's easy!):
http://publib-b.boulder.ibm.com/Redbooks.nsf/RedbookAbstracts/sg246819.html?Open
/Henrik Sjöstrand