Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

transaction rollback during multiple session

 
Abubacker Siddik
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
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.
Abu.A
 
Abubacker Siddik
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Any help guys..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic