-->
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: Commit Insdide @Transactional block
PostPosted: Thu Mar 28, 2013 6:37 pm 
Newbie

Joined: Thu Mar 28, 2013 6:31 pm
Posts: 1
I need to update the DB inside of a bit longer running processes that's wrapped in an @Transactional block. I tried doing the following:

Code:
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
// stuff
tx.commit();
session.close();


but the DB isn't updated until the full @Transactional block complete.

If, instead, I do

Code:
Session session = sessionFactory.getCurrentSession();
// stuff
tx.commit();


That works (commits) immediately, but then the larger block blows up on commit. I've tried opening up a new session at the end but that doesn't work either.

Will this general approach work? Any ideas?

Thanks for your help!

Jeff


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.