I find myself needing a post commit hook on transactions. I am using an event store and need to guarantee that events are not published until the transaction has been committed, because an event handler might require data from the previous transaction.
I am using Guice with the JPA module to wire everything up. I think I could quite easily add a hook by changing JpaLocalTxnInterceptor
from the guice-persist module, I could stop using @Transactional
and do it manually but would prefer to hide this boilerplate, is there a better solution?