Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

using ejb-local-ref

 
Brian Nice
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a session bean which acts as a facade to an Entity Bean, The session bean access the Entity bean through a local interface.
Currently the session bean creates and InitialContext and does a lookup for the Entity bean to get a reference to the local component interface. I could also look up a reference to the Entity Bean by using java:comp/env/ejb environment and using the <ejb-local-ref> tag in the deployment descriptor.
Is there and advantage of using the lookup through java:comp/env/ejb rather than just creating an InitialContext and looking it up regularly?
Thanks
Brian
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Local References keep the lookup code from having to change when the "actual" JNDI name of an EJB changes. This is because the local references give another level of indirection in that they "point" to the actual JNDI name. This grants the deployer more flexibility in setting the JNDI names and allows them to solve problems like versioning easier.
Kyle
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!