Transaction Definition
Transaction Definition
- PROPAGATION_REQUIRED (normally used)
If transaction existed, use it, otherwise open a new transaction
- PROPAGATION_SUPPORTS
If transaction existed, use it, otherwise run as non-transaction
- PROPAGATION_MANDATORY
If transaction existed, use it, otherwise throw Exception
- PROPAGATION_REQUIRES_NEW
Always open a new transaction, if transaction existed, hang up the existed transaction
- PROPAGATION_NOT_SUPPORTED
Always run without transaction, if transaction existed, hang up the existed transaction
- PROPAGATION_NEVER
Always run without transaction, if transaction existed, throw Exception
- PROPAGATION_NESTED (in Spring)
If transaction existed, run nested transaction inside the existed transaction.
If no transaction existed, run as PROPAGATION_REQUIRED
Propagation | T1 None | T1 Existed |
REQUIRED | T2=>new | T1 |
SUPPORTS | T2 None | T1 |
MANDATORY | T2 Exception | T1 |
REQUIRES_NEW | T2=>new | T2=>new |
NOT_SUPPORTED | None | Hang up T1 |
NEVER | None | T2 Exception |
NESTED | As REQUIRED | Nested |
No comments:
Post a Comment