• Post Reply Bookmark Topic Watch Topic
  • New Topic

accessing local home  RSS feed

 
william kane
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do i access local home of a bean.Does it have a different JNDI name than that of Remote Home?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JNDI name is defined by you (the bean deployer) in the deployment descriptor. This holds for both remote and local EJBs. However, it's a common convention to include the word "Local" in your local EJBs' JNDI names. E.g.
  • com/foobar/Account (the JNDI name for remote Account EJB)
  • com/foobar/LocalAccount (the JNDI name for local Account EJB)

  •  
    Vinod John
    Ranch Hand
    Posts: 162
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    From what I understand about local and remote(home)interfaces, both has a JNDI name, both register to some kind of registry (naming service), when the application server is started. But the local interface registers with the registry which is in running in the same process space of as the ejb/application server but in the case of remote the registry can be may be running on a different process space.
    So when a client tries to call the method lookup on a InitialContext object, created with empty parameter list, the search is made on the local registry and the reference to the home (local) interface is returned.
    If the above is correct, is it true that there will always be only one instance of a local home object per ejb per jvm and one instance remote home interface object per ejb per application enviornment, if they are implemented in the EJB.
    The reason I ask this question is, I have notices in programs written by seasoned developers trying to cache local home interface reference in the application, which, I thought, is not useful.
     
    Lasse Koskela
    author
    Sheriff
    Posts: 11962
    5
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by Vinod John:
    The reason I ask this question is, I have notices in programs written by seasoned developers trying to cache local home interface reference in the application, which, I thought, is not useful.

    It may be true for some appservers that caching local interfaces does not provide any value. However, when you've got a caching layer in place, you don't need to be afraid of migrating to another platform. I'm not saying that this caching-just-to-be-sure approach is a wise thing to do, though, as I believe "don't fix it unless it's broken" suits many situations better...
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!