I can't understand the behavior difference between the PROPAGATION_REQUIRES_NEW
and PROPAGATION_NESTED
propagation policies. It seems to me that in both cases, the current process is rollbacked but not the whole transaction. Any clue?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
See this link: PROPAGATION_NESTED versus PROPAGATION_REQUIRES_NEW? Juergen Hoeller explain it very well
Please find the difference
Execute within a nested transaction if a current transaction exists, behave like PROPAGATION_REQUIRED else. Nested transaction is supporting by Spring
2.)Use of REQUIRED Transaction Support a current transaction, create a new one if none exists. . It means for banking domain like withdraw,deposit, update the transaction
3.) Use of REQUIRES_NEW Transaction Create a new transaction, and suspend the current transaction if one exists.
PROPAGATION_REQUIRES_NEW : uses a completely independent transaction for each affected transaction scope. In that case, the underlying physical transactions are different and hence can commit or roll back independently, with an outer transaction not affected by an inner transaction's rollback status.
PROPAGATION_NESTED : uses a single physical transaction with multiple savepoints that it can roll back to. Such partial rollbacks allow an inner transaction scope to trigger a rollback for its scope, with the outer transaction being able to continue the physical transaction despite some operations having been rolled back. This setting is typically mapped onto JDBC savepoints, so will only work with JDBC resource transactions.
check spring documentation