Transactional Isolation And Propagation: Difference between revisions
Jump to navigation
Jump to search
Created page with "==[https://docs.spring.io/spring/docs/5.0.x/javadoc-api/org/springframework/transaction/annotation/Propagation.html Propagation]== Defines how transactions relate to each oth..." |
No edit summary |
||
| Line 1: | Line 1: | ||
==[https://docs.spring.io/spring/docs/5.0.x/javadoc-api/org/springframework/transaction/annotation/Propagation.html Propagation]== | ===[https://docs.spring.io/spring/docs/5.0.x/javadoc-api/org/springframework/transaction/annotation/Propagation.html Propagation]=== | ||
Defines how transactions relate to each other. Common options: | Defines how transactions relate to each other. Common options: | ||
| Line 6: | Line 6: | ||
* <code>Requires_new</code>: Code will always run in a new transaction. Suspends the current transaction if one exists. | * <code>Requires_new</code>: Code will always run in a new transaction. Suspends the current transaction if one exists. | ||
==[https://docs.spring.io/spring/docs/5.0.x/javadoc-api/org/springframework/transaction/TransactionDefinition.html Isolation]== | ===[https://docs.spring.io/spring/docs/5.0.x/javadoc-api/org/springframework/transaction/TransactionDefinition.html Isolation]=== | ||
Defines the data contract between transactions. | Defines the data contract between transactions. | ||
Revision as of 02:32, 19 November 2019
Defines how transactions relate to each other. Common options:
Required: Code will always run in a transaction. Creates a new transaction or reuses one if available.Requires_new: Code will always run in a new transaction. Suspends the current transaction if one exists.
Defines the data contract between transactions.
Read Uncommitted: Allows dirty reads.Read Committed: Does not allow dirty reads.Repeatable Read: If a row is read twice in the same transaction, the result will always be the same.Serializable: Performs all transactions in a sequence.
The different levels have different performance characteristics in a multi-threaded application. Those who understand the dirty reads concept they are able to be select a good option.