• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh


Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello: can anybody help in that topic

I know that I have to narrow the home interface when I want to use acording to the specification laike this:

Context initialContext = new InitialContext();
CartHome cartHome = (CartHome)javax.rmi.PortableRemoteObject.narrow(
initialContext.lookup(“java:comp/env/ejb/cart” ,

But what happend when in a session I invoke a method of a entity that return a collecion of bean? do I have to use portableremoteObject() or a simple cast?

And what happend whith the findByPrimeryKey that return the component interface remote. I never use portableremoteObject, do I should???

Thanks!! a lot
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Narrowing is only for the Initial EJBHome Stub....that too only in case of Remote Calls.... since u r doing a IIOP call which might result in u getting Objects of some other Language type...so u need to make sure that u get the right object from yr IIOP call.

After u get the EJBHome stub... u r all set... then u dont need a narrow call ever... since u already know what Object u r working on....of course u can get a collection from from yr EJBHome object when u fetch more than ONE primary key.... but the whole point is that u r aware that these calls are on the EJBHome STUB ...

But in case of the IIOP lookup u are not sure footed as to what Object type u might be returned ... so PortableRemoteObject.narrow() makes it sure u get the right Object.

Hope this helps...
yeah, but ... what would PIE do? Especially concerning this tiny ad:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic