This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft 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 Java 8 in Action this week in the Java 8 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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why not usertransaction instead of SessionSynchronization in SessionBean
 
Similar Threads
sessionSynchronization
Why does UserTransaction appear in 2 categories?
SessionSynchronization interface
SessionSynchronization interface and stateless session bean
Help of JTA in EJB