Just a small question regarding the narrow method of the PortableRemoteObject Class.
Which steps are required to get the remote component interface using the EJBObject method of the SessionContext interface ?
In my point of view I have to narrow the object (because it is a remote stub) and then cast it. According to the mock we have only to cast it... SO what is true ? I am really surprise about this answer, if anybody can highlight me, it will be greatful.
I thought remote stubs must always be narrowed when you want to use the methods of the remote/home interface.
I dont see why we don't need a narrow for the method getEJBObject() from the SessionContext. For the following example I can understand that we have to make a narrow (to the remote component interface):
If I follow your explainations, it means there are few cases in which we need to narrow:
* JNDI lookups of the remote home interface (your initial lookup of the bean's home). * All calls to getHandle() or getHomeHandle() * All other remote calls to business method returning a remote stub, and only if the return type of the method is not the same as the interface type to which you intend to cast it.
(I took partially this from your Post)
Therefore we do not need to narrow the result of getEJBObject and getEJBHome from the SessionContext (a cast is enough)?