EJB design: setXxxContext

  1. setXxxContext (4 messages)


    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.


    Threaded Messages (4)

  2. setXxxContext[ Go to top ]

    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.

  3. setXxxContext[ Go to top ]

    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.

  4. setXxxContext[ Go to top ]

    See the life cycle diagram for session and entity bean
  5. setXxxContext[ Go to top ]

    R u sure that it is created that many instances in pool?