Urgent.News

What's breaking now, across thousands of outlets.

Tech

Transaction propagation (REQUIRED / REQUIRES_NEW / NESTED ...) (Part 2 of 2)

Picking up between "join" and "start fresh" Part 1 left you with two propagation modes and a clean way to think about them. REQUIRED joins whatever transaction is already running, so everything shares one all-or-nothing boundary. REQUIRES_NEW ignores the outer transaction, suspends it, and runs a completely separate one that commits or fails on its own. Those two are opposites. Join everything,…

In the second part of the article on transaction propagation in Spring, the distinction between nested transactions and Requires_New transactions is explained. Nested transactions use a savepoint mechanism to allow the inner transaction to fail and be undone without affecting the outer transaction, while Requires_New creates a completely separate transaction that commits or fails independently of the outer transaction.

The key difference is that nested transactions rely on the underlying JDBC feature, which only works with certain transaction managers such as Spring's DataSourceTransactionManager. The article also introduces four other transaction propagation modes that complete the set of seven modes, which can be used based on the specific requirements of the code scenario.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Implementing Domain Driven Design - Domain Events ( 1 ) - Definition and Modeling

I know it has been a long time, i was finishing some work, Can we talk about << domain events >> today ? 😄 A - What, When, Why ? 🤔 A - 1 - What is a Domain Event ?

  • Domain events result from domain experts' insights, representing significant domain occurrences.
  • Event names should align with the domain's ubiquitous language, reflecting past command operations.
  • Events are immutable, immutable but can have unique generated identities.

More from Saturday 29 August →