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