What exactly does “Propagation.REQUIRES_NEW” mean using Spring Transaction Management?

my confusion related to this question is how can we use a previously created transaction? or, in other words, how many threads can a transaction be associated with?

+4
source share
1 answer

A transaction can only be associated with one thread in spring. Well, with some effort you can make this a long-term transaction, but it is an afaik anti-pattern.

REQUIRES_NEW means that whenever a program thread enters an annotated method, a new transaction will be launched regardless of any existing transaction.

REQUIRED means that the existing transaction will be reused or if there is no existing transaction, a new one will be launched.

+12
source

All Articles