Discussions

EJB programming & troubleshooting: Differentiate between Stateless and Stateful Sesson Bean

  1. Hi All,

    I am new to EJB programming can anybody differentiate between stateless and stateful sessio bean.Please no defintions.

    Thanks
    blazix
  2. The simple answer:

    1) Stateless Session Beans can't have instance variables. They are more efficient, because they can be pooled and reused by different clients.

    2) Stateful Session Beans can have instance variables, whose values are maintained on behalf of a particular client. They are more powerful, but less efficient, because a State Session Bean object is specific to a particular client and cannot be pooled and reused.