[hibernate-dev] Keeping context in the scope of a transaction

Gunnar Morling gunnar at hibernate.org
Thu Apr 30 04:08:15 EDT 2015


Steve, Andrea,

For OGM we need to store certain data in the scope of a transaction;
specifically this is the list of applied "grid dialect operations", so we
can present these to the user upon failures (and thus "rollbacks") on
non-transactional backends.

Until now we used a custom org.hibernate.Transaction impl for keeping this
data. I am now looking into using the new TransactionCoordinator approach
instead. Is it a save route to initialise the required context upon first
invocation of MyTransactionCoordinator#getTransactionDriverControl() and
clear it via TransactionObserver#afterCompletion()?

It works fine for me in our tests, but I'd like to make sure I am not
missing anything :)

Thanks,

--Gunnar


More information about the hibernate-dev mailing list