JDBC, Transactions, Spring Data JPA
July 30, 2021
M03 Q14 What does transaction propagation mean?
Transaction propagation defines how existing transaction is re-used when calling @Transactional method with transaction already running.
Transaction propagation can be defined in @Transactional annotation in propagation field as one of following options:
REQUIRED- support a current transaction, create a new one if none existsSUPPORTS- support a current transaction, execute non-transactionally if none existsMANDATORY- support a current transaction, throw an exception if none existsREQUIRES_NEW- create a new transaction, and suspend the current transaction if one existsNOT_SUPPORTED- execute non-transactionally, suspend the current transaction if one existsNEVER- execute non-transactionally, throw an exception if a transaction existsNESTED- execute within a nested transaction if a current transaction exists, behave likeREQUIREDelse