• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Narrowing

 
Ramakrishnan Viswanathan
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends

I have a question on narrowing...This is what I read in some articles on the web - "After a lookup operation, it is possible that we might end up with an object that does not implement the home interface of the bean - which is why we narrow".

But I do not understand this... how can we get an object that will not be a home interface type of the bean?

Regards
Ram
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The server may be using RMI-IIOP rather than RMI. IIOP is the wire protocol for CORBA, which basically means that the object returned may not be a Java object. So, the EJB specification requires you to assume that this is the situation and you must therefore narrow the object so that you are guaranteed to get something which you can then cast to the home interface. This makes your bean IIOP-compliant.

Even if you know that the server will always return a Java object (which does not have to be narrowed), you should still narrow to be compliant with the spec and to prevent a future problem if a switch were to be made to an RMI-IIOP server.
 
Ramakrishnan Viswanathan
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Roger.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic