This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes transaction rollback during multiple session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "transaction rollback during multiple session" Watch "transaction rollback during multiple session" New topic

transaction rollback during multiple session

Abubacker Siddik
Ranch Hand

Joined: Aug 12, 2009
Posts: 90
I am trying to write a framework class which can be used by our applications. This class provides methods to create hibernate session and ways to commit and rollback the transaction. I have designed in such a way that there will be always two methods to do commit, rollback and creating sessions. To put it clearly, to create session, one method will give default session by calling openSession on SessionFactory, second method will get a parameter from the user to create new session rather than to return session created by default. Likewise to commit, i will have commit method which will commit default session transaction, but for second commit method, i will get parameter that will accept session object and commit on that particular session. Same applies to rollback method also.

My question is, When user gets session and works on it, an exception occurs that will be caught by my framework class. Now how will i identify which session the user was using and which transaction should i rollback in my catch block? It can be default session or new session created by the customized method. How to know the origin of the exception or from which session the exception was thrown?

Kindly help me guys..

Thanks in Advance.
Abubacker Siddik
Ranch Hand

Joined: Aug 12, 2009
Posts: 90

Any help guys..
I agree. Here's the link:
subject: transaction rollback during multiple session
Similar Threads
please answer this 128 questions for WLS. Urgently!
difference between userTransaction.rollback() & userTransaction timeout
Problem with ejb transaction
Question for CMT Session Bean
Passed SCBCD 5.0 :)