Yes. It's common practice to cache the Home interface in order to avoid the JNDI overhead, and, in fact, I'm preparing to publish something that does just that. The downside is that if you hot-redeploy the EJB, the home interface reference will go stale unless you add logic to detect and correct that.
I'm going to be a "small government" candidate. I'll be the government. Just me. No one else.
The way I do it is just to create a servlet that runs at server startup. In that servlet's init() method, I lookup the home interface(s) and store them into the application context.
I'm going to be a "small government" candidate. I'll be the government. Just me. No one else.
Take a look at Floyd's EJB Design Patterns book on http://www.theserverside.com. The way that I've done it is simply to have a singleton class through which you can lookup and cache JNDI references. Using a singleton does mean that you may have more than one copy in a cluster, but it does mean that you can use the factory from the presentation (web) and business (ejb) tiers of your architecture. Simon