Concurrency control

Stopping two people who opened the same record from silently overwriting each other — detecting that the version you read is no longer the version you are saving over.

Overview

SAP SHIPS
Node.js →

@sap/cds Optimistic concurrency with ETags: an element annotated @odata.etag is the version, and an update whose If-Match no longer holds is rejected by the generic handlers.

Java →

com.sap.cds:cds-services-bom Detects concurrent modification of data across requests with ETags: an @odata.etag-annotated element or a @cds.java.version version element is checked against an If-Match header in OData, or against an explicit ETag predicate in custom code, on update and delete.

Not covered: At one record at a time, and at the protocol. It tells the second writer they lost; it does not merge, and it says nothing about a long-running edit, which is what draft handling exists for.

THE COMMUNITY ADDS

Locking inside a shared draft, which is the long-running edit the ETag does not reach: cap-collaborative-draft takes a lock per OData property and answers HTTP 409 to a second participant patching the same field. See draft handling for the draft itself.

Artifacts3

3 of 3 artifacts
ArtifactSignals
CDS plugins1
cap-collaborative-draftCollaborative draft support for CAP Node.js services
Signals
Functional boundary
Packages2
@sap/cdsCAP Node.js runtime
Signals
none
com.sap.cds:cds-services-bomMaven bill of materials pinning CAP Java module versions
Signals
none

Content2

Group by
Piece, what it offers
Handling Concurrent Updates in SAP CAP Java
SAP Community, Anjali_Pathak, BlogThe reasoning
[Part – 2] Enrich CAP based Services with Behaviors using Annotations
SAP Community, Lukas Schwabe, Blog

Details

Coverage
statecore and community, CAP
assessed
relationshipunassessed
For your agent
Ref
capability:concurrency-control
JSON
/capabilities/concurrency-control.json
MCP
Connecting an agent