• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

where do we bind home object, that we use to look up in InitialContext lookup?

 
Muhammad Shaban Jokhio
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we often use InitialContext's lookup("homeobjectName") method, I wanna ask that where do we bind the home object with this name? in D.Discriptor?
 
Muhammad Shaban Jokhio
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this name is bound in D.Discriptor in the <ejb-name> element
 
Kathy Sierra
Cowgirl and Author
Rancher
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy --
The bind of the Home object to JNDI does NOT happen in the DD -- it happens in a vendor-specific way. Remember, it is the deployer who actually does the binding (during deployment), and it is the deployer who is most closely tied to the company that is deploying the application. The bean developer (i.e. Bean Provider and/or App Assembler) may not know ANYTHING at all about the real server that will utlimately contain the enterprise bean components.
So, there is no element for the JNDI name in the ejb deployment descriptor (DD). The <ejb-name> element is *not* used as the name, in fact, the <ejb-name> is not used for anything outside the DD. Think of the <ejb-name> as a kind of 'label' in the DD, so that *other* parts of the DD can refer back to a particular bean in the DD by using the 'label' (in other words, the <ejb-name> . This is especially true when describing CMP relationships. You don't describe the entire bean that's participating in a relationship, but instead indicate the label (<ejb-name> where that bean's complete information can be found.
For the exam, then, you do NOT need to know any specific way in which the JNDI name is bound, but you DO need to know that it is not part of the DD and that is NOT part of the Bean Provider or Assembler responsibilities. If I am a bean developer, I may not know anything at all about what the spec calls "the operational environment" where the bean/application is going to be deployed. And it is certainly not up to the bean developer to decide or lock down the JNDI name that a particular company is going to use when they deploy the developer's bean.
These are important workflow issues, which is why there *is* a fair amount of coverage on the exam. In reality, most of us do *everything*, but at any given time, we are wearing a particular EJB ROLE hat. Today I am the Bean Provider, writing code, and tomorrow I am the App Assembler, taking my bean and incorporating it with someone else's bean into a new application (for which I also write the client). And then later, I will deploy that application into my server, using vendor-specific tools.
Hope that helps
Remember, you are tested only on what is in the spec, BUT you must also know when you are looking at something that is NOT part of the spec. The main goal is to know that you can write "portable" EJB code... in other words, code that can be deployed into any EJB 2.0-compliant container.
cheers,
Kathy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic