CapabilityData & PersistenceNode.js, read from its artifacts

Transaction management

Deciding where a unit of work begins and ends, and what travels with it: the database transaction that commits or rolls back around a request, the user, tenant and locale that every nested call inherits, and the work that must run outside the request in a transaction of its own. Distinct from concurrency control, which is two writers on one record, and from async processing, which is work that survives the commit.

Showing artifacts, examples and content with confirmed Node.js applicability. View All CAP

Overview

SAP SHIPS
@sap/cds

Starts, joins, commits and rolls back the database transaction around every service call, propagates user, tenant and locale through cds.context, demarcates a transaction by hand with cds.tx() and runs detached background work with cds.spawn().

SourceTransaction Management — capirechecked

A Node.js coverage assessment has not been written. View all flavors

THE COMMUNITY ADDS

No community artifact is confirmed here for Node.js.

A Node.js coverage assessment has not been written. View all flavors

Artifacts1

1 of 1 artifacts
ArtifactSignals
Packages1
@sap/cdsCAP Node.js runtime
Signals
none

Details

What changed — and what it makes stale1
@sap/cds 5.0.4, CAP, Node.js

An event handler no longer wraps its calls in cds.tx(req) to get context propagation and a managed transaction; the service runtime creates the transaction and propagates the context on its own. The old form still works and is deprecated. Dated from the first 5.0 release published on npm.

Makes stale:

Handler code, and the samples it was copied from, that call cds.tx(req) before every read or write as if it were required.

SourceTransaction Management — capirechecked
Coverage
statecore only, CAP, Node.js, derived
For your agent
Ref
capability:transaction-management
JSON
/capabilities/transaction-management.json
MCP
Connecting an agent