Krish,

That's not quite right.  PortableRemoteObject.narrow was introduced as a
portability means for running over IIOP.  It's sort of CORBA's syntactical
contribution to beans.  When running over JRMP this was not a problem.

PortableRemoteObject.narrow Does not do a lookup for you.. but rather
enables you to safely cast your remote proxy to the appropriate type.  It's
merely a safe cast.  Local proxies do not need to be cast this way... but
you still have to get hold of them, so ejb-links are not redundant.

Ejb-links enable you to specify the home name of the beans you want to
lookup (from the same container) at deployment time using the deployment
descriptor.. rather than hardcoding the required information in the bean
doing the lookup (or store this as part of its bean state).  Of course, the
only way to work with references to objects in EJB is via the EjbObject..
eg. you never have a direct reference to the back-end.  If you don't work
with an EjbObject then the only way to get an object is by value through
serialization and those objects are not EJBs.

All the best,

Jon

************************
Jon Ferguson
ObjectTalk
Scotland
email: [EMAIL PROTECTED]
************************


>Hi all,
>
>I was going through the EJB 2.0 pfd 2 and was wondering about
>the section which mentions that a remote interface lookup will
>require a PortableRemoteObject.narrow while the a local interface
>lookup can be just cast (normal java cast) to the home interface.
>
>But now - I have the feeling that ejb-links are redundant. The purpose
>of an ejb-link was to establish fast, easy co-located lookups between
>EJBs in the same jvm - which is exactly what local interfaces are
>supposed to achieve - but with supposedly less overhead plus the
>ability to pass objects by reference instead of by value. But it seems
>like now ejb-links themselves are now used to look up local home
>interfaces.
>
><spec>
>     Context initialContext = new InitialContext();
>     CartHome cartHome = (CartHome)
>           initialContext.lookup("java:comp/env/ejb/cart");
></spec>
>
>Comments on why this seems to be superfluous? Or rather if it
>is so (as I believe)? And what is the role of ejb-links w.r.t remote
>and local interfaces in PFD2?
>
>-krish
>
>===========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff EJB-INTEREST".  For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".
>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to