The EJB spec requires the RMI-IIOP to conform with CORBA standard and Corba standard supports languages (besides C++ or
Java) which does not support direct casting. So, in order to be compliant with RMI-IIOP, if one has to cast a remote reference (which may not be a direct subclass of EJBHome) to a subclass of EJBHome, (s)he has to use PortableRemoteObject.narrow method to do that. This is required as the application server JVM may obtain the reference to the home over RMI-IIOP protocol and the actual implementation of the Home object may reside in an environment outside this JVM.
But, in case of situations like pooled connections or local home, the implemented object reside in the same JVM, which means you can always use downcasting (
polymorphism) and use a direct cast to your home class type.
Hope this helps, but I am sure there will be someone who can better explain this.
[ October 04, 2004: Message edited by: Susanta Chatterjee ]