Differentiate the Entity Bean Class object from entity bean itself. Container precreates the bean objects in memory and keeps in pool. This may happen at startup of container. To do it, container calls constructor and setEntityContext. At this time the EB class instance, its not a full bean yet. Since till now there is no client in picture, ther is no ejb object with it.(*) From (*), if you call create on it, bean is taken from pool , assigned an EJB Object and ejbCreate and ejbPostCreate is called on it...now it has become a bean. From (*), if you call ejbFind(), the bean does not leave the pooled state, just executes finder, simply because it's not been called with a biz method.
When you already have a ejbObject for a bean which is in pool, its ejbActivate is called to bring it in ready state.
ejbActivate will not be called on a bean when ejbCreate is called. ejbPassivate will not be called on bean when ejbRemove is called.
Just to catch a point here, container will follow only 1 of 2 mechanisms available to move a bean from poooooooool to ready state and vice versa.
posted 14 years ago
Hi Amol, thanks for your reply. It sounds clear. My doubt was, mainly, if the bean leaves the pool just after findXXX. As you said it will only leave the pool (and associated) after calling a business method on it. (or after create() of course) thanks a lot Francesco