Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ejb-ref and ejb-local-ref

 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between these two and Why do they have both?
what do they mean by Local?
Thanks
Mark
 
Manjunath Subramanian
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Mark,
If you have worked on EJB , then you will know that there is a EJBHome and EJBObject interfaces,which are implemented by the EJB container.If the client (say a servlet or jsp) wants to communicate with the EJB then they do it with the help of stubs and skeletons.So the calls are basically remote calls.If the client and the enterprise beans are in the same machine running in the same process then there is no need of the client making remote calls to the EJB's if it implements a EJBLocal interface.This interface is implemented by the EJB container very much like the Home and Remote interfaces,so that the client can make local calls instead of remote calls.
The concept of stubs,skeletons,marshalling and unmarshalling doesn't come in the picture.
This increases the performance of the system
If the client is going to make a call on an object which implements the EJBLocal interface then use the ejb-local-ref in the DD.Else if the client is invoking a method call on a EJBObject stub then use the ejb-ref in the DD.
Hope this helps,
Manjunath
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
But I had thought that they always placed the Home object on the JNDI tree, and that you still had to "Connect" to the application server. So by implementing the LocalHome interface the application server knows not to create the stubs and skeletons? hmm pretty interesting.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic