Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to interrupt(stop) the transction while doing the proces

 
stshiva raaj
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to interrupt(stop) the tranaction when its take longer time. I am using thread local to create new session per request.
The process is one request to create the session and commit the transaction. Meanwhile i need to interrupt the transaction after
transaction is created.

Session session = HibernateSessionFactory.createNewSession();
Transaction tran=session.beginTransaction();
................
...............
tran.commit();
My requirement is , i have sent one more request to cancel the transaction. If the transaction is already completed, i just ignore the cancel.
Otherwise, i need to stop the tranasction if it will take longer time.
Session session = HibernateSessionFactory.createNewSession();
Transaction tran=session.beginTransaction();
................
...............//Need to stop the transaction before commit!
...............
tran.commit();
Is it possible? How to achieve this work?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic