BackGround of Session Bean and Entity Beans

Discussions

EJB design: BackGround of Session Bean and Entity Beans

  1. Is two or more users can use the same instance of a
    Session Bean or Entity Bean?.

    How the EjBContext was Handling by the WebContaineer
    for stateful Session Beans.




     



  2. Is two threads can use one instance of Session Bean or
    Entity Bean?

    Any reply will be highly appreciated..

    cheers

  3. Gopi,

    Stateful session beans----technicaly NO
    Stateless Session beans---YES
    ENTITY BEANS--------------YES

    the container maintains a history of the contexts that have accessed a particular sharable object and when a context switching occurs it performs a look up for that particular user details...

    HTH
    Sahil
  4. Hi sahil,

    Just now i some where in the ejb document that no two threads can use the same instance of Session or entity bean.

    cheers



  5. two users/clients canuse the same instance of a stateless session bean, but not the stateful session bean.

    because when a stateful session bean goes for passivation it is passivated with session values to that particular client.and then freed.
    this is the same case applicable to entity beans too.
    container assigns seperate instances from the pool even though, the clients are accessing the same data.