Dave Peterson wrote:
> Perhaps I'm wrong but doesn't the EJB v1.1 spec, specifically section
> 8.9, state:
>
> 'A client program that is intended to be interoperable with all
> compliant EJB container implementations must use the
> javax.rmi.PortableRemoteObject.narrow(...) method to perform
> type-narrowing of the client-side representations of the home AND REMOTE
> interface.'
> (emphasis mine, and any typos are also mine.)
>
> I take this to mean that narrow() is also required when retrieving a
> remote interface from the home. Has this changed in EJB v2.0? Is it
> different than EJB v1.0? I dunno the answers to those two questions.
>
As a general rule of thumb you only need to use narrow() when you would normally
use cast on remote references.
If you are using the create() method on the home interface you do not use the
PortableRemoteObject.narrow() method because the type is already known. In other
words, the create() method already returns the proper remote type. In addition,
you do not need to narrow() remote references returned from single-object find
methods.
As Evan Ireland pointed out, however, the narrow() method will be needed if you
obtain a collection of remote references from a find method, since each reference
in the collection needs to be narrowed to its proper type.
The guidelines for using the narrow method are explained in detail on page 134 of
O'Reilly's *Enterprise JavaBeans, 2nd Edition*.
--
Richard Monson-Haefel
Author of Enterprise JavaBeans, 2nd Edition
Published by O'Reilly & Associates
http://www.EjbNow.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".