Could someone please clarify how to know when to narrow an object. I understand that we need to narrow remote stubs but how do we tell what a remote stub is. For example, in mock exams I have seen that we need to narrow the result of handle.getEJBObject() which return EJBObject but just need a normal Java cast for EJBContext.getEJBObject()
How are you supposed to tell the difference??
Here's a list of what I do know. Must narrow: jndi lookup of EJBHome Single entities from Finder method Collection results getEJBObject from Handle class getEJBHome from Home Handle
Need not narrow: EJBContext.getEJBObject Single Finder method results EJBObject creation in create methods
What happens with: EJBContext.getEJBHome EJBObject.getEJBHome
EJBContext public EJBHome getEJBHome() Obtain the enterprise bean's remote home interface. Returns: The enterprise bean's remote home interface. Narrowing not needed
HomeHandle public EJBHome getEJBHome() Obtain the home object represented by this handle. Narrowing needed
EJBObject public EJBHome getEJBHome() Obtain the enterprise Bean's remote home interface. Returns: A reference to the enterprise Bean's home interface. Narrowing not needed [ March 30, 2005: Message edited by: Ravindra Janapareddy ]