EJB design: Difference between stateful session bean and stateless session b

  1. Dear all,

    I am new to ejb tech,

    i want to know the difference between stateful session bean

    and statless session bean and how the state is maintained
  2. My View[ Go to top ]

    just like session parameter and application parameter
  3. You would use stateful session beans to maintain converstaion state, just as you would use HttpSession. There are many debates about which of these to use. One reason for using stateful session beans over HttpSession is that your client may not be http based. Stateful session beans do not tend to scale well.

    Stateless session beans can maintain state, but it's only useful if it's not conversational, as it is unlikely that the same stateless session bean instance will be used across requests by the same client. The idea behind a statelsss session beans is that any instance can server any request. An example of state that may be held in a stateless session bean would be a database connection, or a JNDI connection.