• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ejb-reference vs. jndi look up

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understand that when look up a EJB A, I can either by its ejb-reference entry in deployment descriptor or its JNDI entry.

It is my understanding that if I look up a bean from a remote client, I must use the JNDI entry; and if I do that from a remote EJB B, I can do either way provided that the deployment descriptor for B defines ejb-reference to A, and use ejb-reference is preferred over a direct JNDI look up.

If I have a delegate class that wraps up the look up logic, and this delegate can be called by either a remote client or another EJB, then, I wil l have to supply two methods, one to look up JNDI for the client to use, and another to look up ejb-reference for other EJBs to use, right? I do not like that, but is there a one-function-fits-all solution?

what is the advantage of using ejb-reference vs. a direct JNDI lookup?

My thought is that, according to EJB spec, the deployer sets JNDI entry, therefore, when we code EJB to call another EJB, we as bean developer do NOT know the JNDI yet. However, the client developer always sees the JNDI, since they get the deployment descriptor after the deployer fills in JNDI. Is my understanding correct? In other words, there really is no difference whether to use ejb-reference or a direct JNDI lookup.

Thanks.
Yan
 
Evildoers! Eat my justice! And this tiny ad's justice too!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic