This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

More information about the ejb-ref element of ejb-jar.xml  RSS feed

 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am currently studying ejbs and I came across the ejb-ref element of the ejb-jar.xml file. I am in reference to O'Reilly Entreprise JavaBeans book. The book says that, thanks to the ejb-ref element it is possible to access one ejb from another ejb with the following client code:



I thought one could invoke the above client code without the ejb-ref element being present in the ejb-jar.xml... I am right or wrong?

Then why the need for the ejb-ref element? Can anyone give me a concrete example of usage of the ejb-ref element where the ejb-ref element really is useful? What are the advantages of using the ejb-ref element?

Thanks in advance,

Julien Martin.
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ejb-refs allow you to induce a level of indirection in your code, such that is your bean is bound to a different JNDI name, you don't need to recompile your code and redeploy. This is probably expounded upon in the EJB specs since it's the recommended way to do all lookups in beans.
 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Thanks for your reply. Can you tell me how the client code for accessing a bean through ejb-ref would look like please?
Thanks in advance,
Julien Martin.
 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the answer to my question. However what I would like to know is if using ejb-ref and ejb-local-ref will make my application more performant in terms of speed?
Julien
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!