Quote : "SessionSynchronization is for CMT beans ONLY". Quote : "Stateless Session beans cant implement SessionSynchronization, because session beans aren't allowed to maintain a transaction once a method has enden".
But even stateful session beans using CMT, dont allow a transaction to be maintained. This feature is only available with BMT. How come then only stateful beans are allowed to use SessionSynchronization.
That gave me a headache too. The first part of the statement is correct, but the "because" part is just wrong. It does make sense if you alter it:
"Stateless Session beans can't implement SessionSynchronization, because stateless session beans aren't allowed to maintain a conversational state once a method has ended."
The three SessionSynchronization methods are used to ensure the conversational state stays consistent as transactions are started, committed, and rolled back. You would expect to see them synchronize the conversational state with a database.
For Stateless Session Beans (and MDBs), this would be a waste of time, because the conversational state is meaningless once a business method returns.
For BMT Stateful Session Beans, you have control over what happens and where with the transaction, so you don't need container callbacks.
For Entity Beans, the same sort of functions are performed by ejbLoad and ejbStore. [ January 24, 2006: Message edited by: Greg Charles ]
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop