Howdy,
Stateful session beans can be passivated, which is their only hope of scalability (although there will always be some level of a performance 'hit' for passivation/activation). But as Nathaniel mentioned, they can't be passivated while in a transaction. Now, you ideally want to design your app to keep transactions as short as possible, since EVERYTHING in your app will be hurt by long transactions, so the issue of transactions may not be a problem for your app that has stateful beans.
There *are* times when stateful beans, despite their weakness, may be the best choice for an app because you still have to put the conversational state *somewhere*, and the *other* options may end up being a worse choice than stateful beans. Some people use HTTP sessions, but that doesn't always save you much, and you are then FORCING your application to be a web app.
You could just keep passing the data back and forth as arguments to stateless methods, but then you might be affecting bandwidth... and of course you could just keep writing the state to a database, but THAT'S definitely a big performance hit...so there is a lot to consider.
I think my point is that while stateful beans have issues that make them *less* scalable than stateLESS beans, they should not be automatically dismissed as *bad*. Sometimes they might be the best option, and passivation *does* give them some help with scalability.
Sheesh, I think I sound like a cheerleader for stateful beans. I'm not really, but I do think they've gotten a worse reputation than they deserve... and *somebody* has to defend them
Cheers,
Kathy
[ May 01, 2004: Message edited by: Kathy Sierra ]