This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Why not usertransaction instead of SessionSynchronization in SessionBean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Why not usertransaction instead of SessionSynchronization in SessionBean" Watch "Why not usertransaction instead of SessionSynchronization in SessionBean" New topic
Author

Why not usertransaction instead of SessionSynchronization in SessionBean

Sanju
Ranch Hand

Joined: Jul 15, 2002
Posts: 53
Hi,
In Session Bean we can use SessionSynchronization. Why not usertransaction instead of SessionSynchronization? what is the major advantages SessionSynchroniation interface?

Regards,
Sanju.


Thank you,<br />Sanju
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi Sanju,

The SessionSynchronization interface is used with BMT and allows you to synchronize the instance variables with their corresponding values in the database. UaserTransaction interface on the other hand, is used with BMT and gives you the control over the transaction boundaries. You can have multiple (linear not nested) transactions starting and ending within the same method if you want, etc. This type of granularity you cannot achieve with BMT.
Regards.


I think, therefore I exist -- Rene Descartes
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Please correct this:

The SessionSynchronization interface is used with BMT

With:
The SessionSynchronization interface is used with CMT
Sorry...
 
Consider Paul's rocket mass heater.
 
subject: Why not usertransaction instead of SessionSynchronization in SessionBean
 
Similar Threads
SessionSynchronization interface
Why does UserTransaction appear in 2 categories?
sessionSynchronization
SessionSynchronization interface and stateless session bean
Help of JTA in EJB