I am a little confused as to the usage of stateful session beans (SFSB) versus stateless session beans (SLSB).
I understand that SFSB's maintain state with a client. This helped: When to use Stateful session bean over Stateless session bean?
The example provided here and in many other places is the shopping cart for SFSB.
My question is why does one need a SFSB if the application is backed by a database? Would a shopping cart typically update the database every time there is a change to it? or does the state reside in the SFSB until it is not needed (and then dumped to the DB) like some sort of cache??
"If a task needs a series of method calls (more than one) and you need to keep previous results to use them in next call then SFSB can be used" - source. This would be more like checkout (forms between pages??) where nothing would be saved in the DB until the last page. But for a shopping cart I would imagine writing to the DB whenever the user adds something to their cart?
Or am I missing the point of a SFSB :)