what exactly "Propagation.REQUIRES_NEW" means using Spring transaction management?
my confusion related to this matter is that how we can use a previously created transaction? or in other words how many threads a transaction could be r开发者_C百科elated to?
A transaction can be related to only one thread in spring. Well, with some effort you can make it a long-running transaction, but that's an anti-pattern afaik.
REQUIRES_NEW
means that whenever the program flow enters the annotated method, a new transaction will be started regardless of any existing transaction.
REQUIRED
means that an existing transaction will be reused, or if there's no existing transaction a new one will be started.
精彩评论