liveBook · Manning

Database transaction

Also called unit of work

A database transaction is a bounded unit of database operations whose changes are treated as one logical whole, typically committed or rolled back together.

How 21 Manning books explain it

The Art of Unit Testing 3e

The complete sequence of actions between triggering an entry point and observing a noticeable end result through one or more exit points.

How it is used
Distinguishes the testing unit of work from a database dependency; does not establish a role for database transactions.
How deep it goes
Defines entry points and observable exit points, but does not define or explain database transaction behavior.
Examples
Uses a sum function with a return value and running total, plus in-memory UI-button and form tests.

Read how The Art of Unit Testing 3e explains database transaction →

Java Persistence with Spring Data and Hibernate epub

A transaction is a database unit of work whose operations are handled as a coherent atomic interaction.

How it is used
Uses transactions to bound atomic database work and isolate concurrent application operations.
How deep it goes
Explains demarcation, persistence-context synchronization, isolation anomalies, rollback rules, and test behavior while focusing on single-database transactions.
Examples
Illustrates auction completion, an EntityManager unit of work, concurrent updates, and transactional Spring tests.
What you can do after
Apply transactions through Jakarta Persistence and Spring, including configuring rollback behavior and transactional tests.

Read how Java Persistence with Spring Data and Hibernate epub explains database transaction →

Crack Any Codebase with AI

A database transaction is a unit of database operations that is committed or rolled back as a whole.

How it is used
Maps which database writes commit together while separating blocking external calls and background work.
How deep it goes
Traces transaction boundaries to individual writes and commit points, then stops at failure risks from external calls outside them.
Examples
Uses cancellation updates, audit writes, booking insertion, Stripe refunds, calendar calls, video rooms, and notifications.
What you can do after
Diagnose/debug with it by drawing transaction boundaries and locating half-written states after crashes or failed network calls.

Read how Crack Any Codebase with AI explains database transaction →

The Joy of JavaScript

A book-local transaction object in the blockchain domain that models a transfer record and related behavior.

How it is used
Models a transfer record in a simplified blockchain application and anchors examples of JavaScript object design.
How deep it goes
Works through object construction and composable behavior, but defers cryptographic hash internals and key handling.
Examples
Uses a coffee payment, prototype-linked transfer objects, constructor functions, and a Transaction instance assembled with mixins.
What you can do after
Build it from scratch as a JavaScript transfer object and compose its hashing, signing, and validation interfaces.

Read how The Joy of JavaScript explains database transaction →

Spring Start Here, Second Edition

A transaction is a unit of data processing whose changes are managed together so that either all required changes succeed or none are applied.

How it is used
Uses transactions to keep a Spring wallet transfer consistent when related account updates fail.
How deep it goes
Explains atomicity, commit, rollback, Spring aspect interception, and default exception behavior through a worked application.
Examples
Demonstrates a two-account transfer and simulates a runtime exception after both balance updates.
What you can do after
Apply it via Spring's @Transactional annotation to group service-method changes and recognize default rollback behavior.

Read how Spring Start Here, Second Edition explains database transaction →

Think Distributed Systems

A transaction is a logical unit of work whose operations are treated as a single coherent execution with specified correctness properties.

How it is used
Uses transactions to make concurrent, failure-prone applications appear correct and complete without visible coordination logic.
How deep it goes
Defines ACID and serializability, explains concurrency and failure scenarios, and stops short of implementation internals.
Examples
Uses money transfers, concurrent balance updates, failed multi-write operations, SQL constraints, and single- versus multi-resource-manager execution.
What you can do after
Evaluate/understand how transactions provide atomicity, correctness, and completeness under concurrency and failure.

Read how Think Distributed Systems explains database transaction →

Unit Testing Principles, Practices, and Patterns

A database transaction is a sequence of database operations treated as a single unit that can be committed or rolled back.

How it is used
Governs related database mutations in production and supports close-to-production integration testing.
How deep it goes
Explains atomicity, connection boundaries, shared transactions, unit of work, and test isolation, stopping short of database-engine internals.
Examples
Uses a CRM ChangeEmail operation, shared repositories, Entity Framework context reuse, and startup database cleanup.
What you can do after
Apply database transactions and units of work to keep business mutations atomic and design integration tests without production-divergent transaction wrappers.

Read how Unit Testing Principles, Practices, and Patterns explains database transaction →

100 SQL Server Mistakes and How to Avoid Them

A database transaction is a logical unit of work whose operations are committed or rolled back as a group.

How it is used
Protects related sales-order updates from being committed only partially when an error occurs.
How deep it goes
Defines ACID properties and demonstrates open-transaction diagnosis, rollback, TRY...CATCH, and transaction-log consequences.
Examples
Uses an InsertSalesOrder procedure, a renamed detail table, constraint failures, error messages, and batched deletion guidance.
What you can do after
Diagnose/debug with it by detecting an open transaction and rolling it back after a failed procedure.

Read how 100 SQL Server Mistakes and How to Avoid Them explains database transaction →

Grokking Software Architecture

A unit of database work treated as a single operation with defined consistency and recovery behavior.

How it is used
Uses transactions to illustrate data integrity in relational databases.
How deep it goes
Explains each ACID guarantee through a worked scenario and distinguishes durability from backup.
Examples
Illustrates a flash-sale purchase with inventory and order records, a payment timeout, and an accidental deletion.
What you can do after
Evaluate transaction guarantees and distinguish durability from backup protection.

Read how Grokking Software Architecture explains database transaction →

.NET in Action, Second Edition

A transaction is a database operation boundary whose changes are committed together or discarded together to prevent partial completion.

How it is used
Protects related account-balance updates from partial completion when an operation or its surrounding infrastructure fails.
How deep it goes
Works through separate saves, a failing test, explicit commit and rollback, change-tracker cleanup, and transaction-aware retry.
Examples
Uses a C# account-transfer repository, an insufficient-funds test, and EF Core transaction-helper listings.
What you can do after
Apply it via EF Core to commit or roll back account updates together and account for retries after uncertain commits.

Read how .NET in Action, Second Edition explains database transaction →

MongoDB 8.0 in Action, Third Edition

A transaction is a group of database operations committed as one unit or rolled back so that partial execution is not persisted.

How it is used
Coordinates related MongoDB reads and writes when a change spans documents and partial updates would be unacceptable.
How deep it goes
Works through session setup, commit or abort, retries, and driver callbacks, then gives operational limits and restrictions.
Examples
Uses a flight-and-hotel booking and account, customer, and transaction-record updates implemented in mongosh and driver listings.
What you can do after
Apply it via mongosh or MongoDB driver Callback APIs to commit coordinated writes and handle failures.

Read how MongoDB 8.0 in Action, Third Edition explains database transaction →

Microservices Patterns, Second Edition

A unit of work whose operations execute under defined consistency and completion semantics.

How it is used
Uses transactions to make system commands and queries consistent within monolithic and distributed architectures.
How deep it goes
Explains correctness challenges and transaction boundaries, then contrasts single transactions with service-local transactions and their coordination costs.
Examples
Illustrates order creation with a product lookup, conditional credit update, and order insertion, plus an order-details query.
What you can do after
Evaluate transaction boundaries when choosing between a single database operation and coordinated transactions across services.

Read how Microservices Patterns, Second Edition explains database transaction →

Building Web APIs with ASP.NET Core

A unit of work is a pattern that tracks objects affected by a business transaction and coordinates persisting their changes and resolving concurrency problems.

How it is used
Frames DbContext usage as one application-level unit of work per HTTP request/response lifecycle.
How deep it goes
Defines unit-of-work responsibilities and traces a read request, but does not detail write coordination or concurrency-resolution implementation.
Examples
Uses BoardGamesController, ApplicationDbContext, the BoardGames query, and ToArray() to demonstrate request-scoped retrieval.
What you can do after
Apply it via ASP.NET Core dependency injection by querying a database through a controller’s ApplicationDbContext.

Read how Building Web APIs with ASP.NET Core explains database transaction →

Quarkus in Action

A transaction is a logical unit of work whose operations are coordinated to satisfy defined consistency and completion guarantees.

How it is used
Coordinates database writes in Quarkus services so entity changes can reach the database.
How deep it goes
Explains boundaries, propagation choices, manual APIs, and flush behavior, but does not develop distributed transaction processing.
Examples
Uses GraphQL inventory mutations, gRPC persistence callbacks, and QuarkusTransaction wrapper code.
What you can do after
Apply it via @Transactional or QuarkusTransaction to give database writes an appropriate boundary.

Read how Quarkus in Action explains database transaction →

Django in Action

A database transaction is an atomic group of database actions that either completes as a unit or can be rolled back as a unit.

How it is used
Isolates Django database tests so each method starts from a predictable state.
How deep it goes
Explains atomic grouping and automatic rollback within Django tests, without detailing broader application-level transaction management.
Examples
Uses a Musician fixture and a client request to test status, response context, and rendered content.
What you can do after
Diagnose test isolation by creating ORM fixtures, exercising views, checking responses, and relying on rollback between methods.

Read how Django in Action explains database transaction →

Build Python Web Apps with Streamlit

A database transaction is an atomic unit of database work whose modifications remain provisional until committed or are discarded by rollback.

How it is used
Uses transactions to make database writes permanent only after explicit confirmation and to protect failed writes from leaving temporary changes.
How deep it goes
Explains transactions through SQLAlchemy sessions, commit, rollback, and exception handling without detailing isolation levels or concurrency.
Examples
Demonstrates a Streamlit haiku application that commits successful write queries and rolls them back after errors.
What you can do after
Operate a SQLAlchemy-backed Streamlit database layer that commits successful writes and rolls back failed write operations.

Read how Build Python Web Apps with Streamlit explains database transaction →

API Design Patterns

Transactional semantics are execution rules in which multiple data changes are committed together or rolled back together as one unit.

How it is used
Coordinates multi-resource changes, especially copy, move, and dependent API updates.
How deep it goes
Explains atomicity, snapshots, rollback, concurrency, and API limitations without detailing transaction implementation internals.
Examples
Uses resource copying, resource moving, and ChatRoom logging configuration updates as concrete cases.
What you can do after
Evaluate when multi-resource operations require atomic or transaction-like semantics to avoid partial success.

Read how API Design Patterns explains database transaction →

Designing AI Systems

A database transaction is a sequence of database operations treated as one unit of work with a shared commit or rollback outcome.

How it is used
Uses transactions to preserve conversation history and document indexes during multi-step writes.
How deep it goes
Explains transaction boundaries, failure rollback, and bulk index consistency, but does not detail isolation levels or locking.
Examples
Demonstrates batch message insertion and document replacement spanning deletion, chunking, embedding, and insertion.
What you can do after
Apply it via PostgreSQL commits to prevent partial session writes and failed document ingestion from corrupting stored state.

Read how Designing AI Systems explains database transaction →

The Coder Cafe

A transaction is a sequence of database operations treated as one logical unit of work with defined consistency and atomicity behavior.

How it is used
Groups related database operations so applications can preserve integrity during failures and concurrent work.
How deep it goes
Explains ACID properties, lifecycle steps, isolation levels, rollback, and savepoints, while deferring some invariants to application logic.
Examples
Uses bank transfers, database writes, Kafka messages, commit, rollback, and PostgreSQL savepoints as concrete illustrations.
What you can do after
Operate transactions by beginning work, performing operations, and choosing commit, rollback, or a savepoint-based rollback.

Read how The Coder Cafe explains database transaction →

Build and Orchestrator in Go (From Scratch)

A database transaction is an operation context that provides a consistent view of database data while applying reads or writes.

How it is used
Uses transactions to provide consistent reads and safely modify persistent task data.
How deep it goes
Explains transaction types, callback APIs, bucket access, iteration, error handling, and read-write operations through store methods.
Examples
Demonstrates task counting, retrieval, listing, bucket creation, and JSON-backed insertion in a persistent task store.
What you can do after
Apply it via BoltDB to implement consistent reads and writes for a persistent task store.

Read how Build and Orchestrator in Go (From Scratch) explains database transaction →

Learn Haskell by Example

A database transaction is a sequence of operations treated as one atomic unit that can be committed or rolled back.

How it is used
Protects database updates from failures while adding and updating todo entries.
How deep it goes
Explains the BEGIN, action, COMMIT, and ROLLBACK sequence and stops short of broader transaction management.
Examples
Uses todo-entry insertion, duplicate IDs, last-inserted row IDs, and checked-field updates as concrete cases.
What you can do after
Apply it via Database.SQLite.Simple to commit grouped actions or roll them back after exceptions.

Read how Learn Haskell by Example explains database transaction →

Also covered in

What to know first

Related concepts

Questions about database transaction

What is database transaction?

A database transaction is a bounded unit of database operations whose changes are treated as one logical whole, typically committed or rolled back together.

Which Manning books explain database transaction?

The Art of Unit Testing 3e, Java Persistence with Spring Data and Hibernate epub, Crack Any Codebase with AI, The Joy of JavaScript, Spring Start Here, Second Edition, Think Distributed Systems, Unit Testing Principles, Practices, and Patterns, 100 SQL Server Mistakes and How to Avoid Them and 13 more.

What should I know before learning database transaction?

Manning books that teach database transaction usually introduce SQL, ACID, distributed system and concurrency first.

What are the parts of database transaction?

Database transaction includes entry point, exit point, Hibernate session, span and span id.

What is database transaction also called?

Database transaction is also called unit of work.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.