It's a compatibility issue. A simple cast works in the case of an EJB server
using RMI. However, if you're communicating with an EJB server that uses RMI
over IIOP, you must use explicit narrowing, as CORBA doesn't support casting.
By using the narrowing syntax in all cases, you're client code is more
compatible across a range of EJB servers.
Mik
"Bhattacharyya, Ana" wrote:
> Hi all,
> I am getting as to how the PortableRemoteObject.narrow helps when compared
> to the simple cntxt.lookup!!!. The code is given below
> Object objref = ctx.lookup("pool.Register");
> RegisterHome registerhome =
> (RegisterHome)PortableRemoteObject.narrow(objref,
> connectpool.RegisterHome.class);
> compared to
> RegisterHome registerhome = (RegisterHome) ctx.lookup("pool.Register");
> Hey, to me it seems the 1st one increases the # of lines of code!!!! but
> what values does it add???
> Any help to clear this doubt is appreciated.
> TIA
> Anamitra
>
> ===========================================================================
> 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".
--
//////////////////////////////////////////////////////
//
// Mike Clark
//
// Clarkware Consulting
// Enterprise Java Architecture, Design, Development
//
// http://www.clarkware.com
// [EMAIL PROTECTED]
// +1.720.851.2014
//
===========================================================================
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".