JTA spec states in 3.3.2 Transaction Synchronization:
The Synchronization.beforeCompletion method is called prior to the start of the two-phase transaction commit process. This call is executed with the transaction context of the transaction that is being committed.
I guess the event is fired too eagerly in the test because I think the synchronization callback is called once the method (EjbTestBean#initTransaction in this case) was executed. |