Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Narrowing  RSS feed

 
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
 
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.
 
Can't .... do .... plaid .... So I did this tiny ad instead:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!