Transactional Isolation And Propagation

From Chorke Wiki
Revision as of 20:24, 18 November 2019 by Shahed (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Propagation

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.

Isolation

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.

References