-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Checking if CurrentSession has an un-committed transaction
PostPosted: Mon Aug 07, 2006 8:28 pm 
Beginner
Beginner

Joined: Wed Feb 04, 2004 5:21 pm
Posts: 37
Im trying to postpone transaction commits until the Servlet.service is done.

So I have this sort of functionality to clean up and close the session

Session s = (Session) currentSessionHolder.get();
currentSessionHolder.set(null);
if (s != null) {
Transaction trx = s.getTransaction();
if (trx != null && trx.isActive() &&
!trx.wasCommitted() && !trx.wasRolledBack())
trx.commit();
s.close();
}

I don't see why it shouldn't work. But it apparently fails.


org.hibernate.TransactionException: Transaction not successfully started
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:100)


Is there another way I will have to do this?

Henrik


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.