In case of stateless Session Beans, we have multiple lookups for Home for different Business methods inside wrapper class. Would this result in too much memory consumption ?
JNDI llokup only returns reference to Home Object so I don't think it is resource intensive process. If we look up again for same Home , it shouldn't consume too much memory . Can anyone clarify ?
It's not the memory required, but the performance hit introduced by fetching the home interface from JNDI for every call. One of the most efficient ways of improving performance of EJB applications is to cache home interfaces.
Of course this has some glitches, e.g. what if the EJB is updated and the home interface needs to be sync'ed, and so on.
I use a utility class to do home lookups and cache the home objects on the first call. To handle the situation where the EJBs are updated (hot deployed in WebLogic terms), I have a method to clear the cache. The catch is that the application has to catch the weblogic.ejb.internal.RedeploymentException when it tries to invoke a method on the "old" EJB. I wish there was a more portable way to do this.