• 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

accessing local home

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)

  •  
    Ranch Hand
    Posts: 162
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
    Posts: 11962
    5
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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...
     
    He does not suffer fools gladly. But this tiny ad does:
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic