aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes SessionSynchronization !! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "SessionSynchronization !!" Watch "SessionSynchronization !!" New topic
Author

SessionSynchronization !!

Puneet Vashisht
Ranch Hand

Joined: Jul 30, 2005
Posts: 44
HFEJB Pg No.513

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.

Thanks,
Puneet
Micheal Jacob
Ranch Hand

Joined: Nov 25, 2002
Posts: 89
Follow this link.
web page
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2851
    
  11

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 ]
 
wood burning stoves
 
subject: SessionSynchronization !!