collection Commons
Private · saved on this device

Persistence and Transactions

Separate domain-facing data access from storage details and make persistence and consistency responsibilities explicit.

These patterns examine how applications retrieve and store domain state, and where responsibility for durable and consistent changes belongs.

Repository supplies a domain-oriented collection interface while keeping queries and mapping behind a deliberate access contract. It distinguishes that contract from transaction ownership and storage guarantees.

Data Mapper translates between domain objects and database representations while keeping persistence knowledge outside the model.

Active Record combines a record's state, local domain behavior, and database operations in one object, with explicit persistence lifecycle choices.

Unit of Work tracks pending object changes and coordinates their persistence and completion within one business operation.

Identity Map reuses one live object per persistent identity within an explicitly owned scope, separating local identity from database freshness.

Lazy Load defers omitted object data until it is needed, with explicit loading, failure, and resource-lifetime policies.

Optimistic Offline Lock checks the version originally read and commits its conditional update, version advance, and edit-log row together, rejecting stale proposals.

Pessimistic Offline Lock reserves write ownership across requests and validates the current acquisition token when saving or releasing the reservation.

Database per Service keeps persistent data behind its owning service contract, enforcing private access independently of shared or separate physical hosting and exposing cross-service coordination costs.

CQRS separates the behavioral model for business changes from query-specific representations, with shared or separate storage and an explicit consistency policy.

Event Sourcing records accepted business changes as authoritative history, reconstructing state through ordered replay and protecting conditional appends against stale decisions.

Transactional Outbox commits a business change and its outgoing message together, then relays committed intent with explicit retry and duplicate-delivery boundaries.

Curated selection

In this Collection

12 entries · Author-defined order
  1. Software Engineering

    pattern · commons

    Repository

    Expose a domain-oriented collection of objects while keeping storage queries and mapping details behind a deliberate access contract.

  2. Software Engineering

    pattern · commons

    Data Mapper

    Move data between domain objects and database representations through a separate mapping layer, keeping persistence details out of the model.

  3. Software Engineering

    pattern · commons

    Active Record

    Put a row's data, domain behavior, and database access operations on the same object, giving callers a direct record-oriented API.

  4. Software Engineering

    pattern · commons

    Unit of Work

    Track the objects affected by a business operation and coordinate their persistence changes within one explicit completion boundary.

  5. Software Engineering

    pattern · commons

    Identity Map

    Keep one live object for each persistent identity within a defined scope, and reuse that object whenever the identity is loaded again.

  6. Software Engineering

    pattern · commons

    Lazy Load

    Load the lightweight part of an object first, keeping a way to fetch its deferred data when that data is actually needed.

  7. Software Engineering

    pattern · commons

    Optimistic Offline Lock

    Retain the version read at the start of an edit, and accept its final write only if that version still matches in an atomic save transaction.

  8. Software Engineering

    pattern · commons

    Pessimistic Offline Lock

    Reserve write ownership before a long edit, retain that logical lock across requests, and validate ownership when saving or releasing it.

  9. Software Engineering

    pattern · commons

    Database per Service

    Keep each service's persistent data private to its owner, exposing business contracts instead of allowing other services to depend on its tables.

  10. Software Engineering

    pattern · commons

    CQRS

    Separate the model that handles business changes from the model that answers queries, so each can serve its own responsibilities without forcing one representation to do both.

  11. Data EngineeringSoftware Engineering

    pattern · commons

    Event Sourcing

    Make accepted business events the authoritative record and reconstruct state by applying them in order, keeping replay separate from repeated external actions.

  12. Data EngineeringSoftware Engineering

    pattern · commons

    Transactional Outbox

    Save an outgoing message with its business change in one database transaction, then relay committed messages with duplicate handling.