For stateless beans and entity beans a pool of beans is created by the container. Are setSessionContext/setEntityContext methods called for every instance that is placed in the pool. If it is called for every instance then why the println statement in my setXXXContext is printing just once.
setSessionContext() & setEntityContext() is only called when the container creates the bean and place it in the pool. Any call by the client to the beans in the pool will not invoke the setXXX()Context method.
u will understand better if u look at the life cycle diagram for each bean.
Read the doubt completely before answering it. We know that setXXXContext will be called by the container before the instance is placed in the pool. Why it is called only once when there are many instances in the pool.
See the life cycle diagram for session and entity bean
R u sure that it is created that many instances in pool?