I have a situation in which something needs to occur before a transaction is committed, but I cannot invoke this everywhere tx.commit() eventually gets called. Is there a way to configure a listener within JBoss such that it is notified before a transaction is committed (or at least before tx.commit() actually does the commit)?
Specifically TransactionSynchronizationRegistry does not work in our case because it was introduced with JTA 1.1 and JBoss 4.0.1sp1 seems to only support JTA 1.0.1. However, JTA 1.0.1 supports the Synchronization interface and the Transaction interface defines a registerSynchronization() API.
I was able to create a class that implements Synchronization and registers it with the current transaction.