Johan
Johan

Reputation: 40558

Notification when Spring starts a transaction?

I'd like to be notified when Spring starts a transaction. I'm aware of org.springframework.transaction.support.TransactionSynchronizationManager but afaik you can only use it to get notified of the transaction phases that defined in org.springframework.transaction.event.TransactionPhase (BEFORE_COMMIT, AFTER_COMPLETION, AFTER_COMMIT, AFTER_ROLLBACK). But how can I get notified just before or after a transaction has started?

Upvotes: 0

Views: 98

Answers (1)

Essex Boy
Essex Boy

Reputation: 7950

Overide org.springframework.transaction.jta.JtaTransactionManager

@Override
protected void doBegin(Object transaction, TransactionDefinition definition) {
   //UUID code here
   super.doBegin(transaction, definition);
}

Upvotes: 1

Related Questions