Hibernate transaction events in Spring
I am implementing an event queue for the Hibernate event system for my application. I want to delay the dispatching of events to a point where Hibernate session has been flushed but the transaction has not yet committed so I can start a new session which then does some updates. Basically, I want an update to a domain object trigger an update to its children.
I know I can use the TransactionSynchronization interface to catch before commit and after commit events but how can I get begin commit events? I tried overriding doBegin of HibernateTransactionManager but it is called before transaction synchonization is initialized, so I cannot call TransactionSynchronizationManager.registerSynchron ization() there.
Is there a way to receive transaction begin events from Spring?
Reaktor Innovations Oy