---
title: "Persistence layer in Extbase"
manual: "TYPO3 Explained"
version: "main"
permalink: "https://docs.typo3.org/permalink/t3coreapi:extbase-start-database-interaction@main"
source: "ExtensionArchitecture/Extbase/Persistence/Index.rst"
rendered: "2026-09-20T15:52:37+00:00"
---

# Persistence layer in Extbase {#extbase-start-database-interaction}

The persistence layer is where Extbase turns database rows into domain objects
and writes your changes. Once your models and repositories exist, this
chapter is about *using* them well: querying for the right records, setting
which pages and languages a query covers, loading all related objects, and knowing
the performance trade-offs before they bite.

This chapter assumes you already have a model and a repository. If you do not,
start with the domain chapter:

> [!NOTE]
> **See also**
>
> -   [Persistence and the Extbase ORM](https://docs.typo3.org/permalink/t3coreapi:extbase-concepts-persistence@main) — the mental model: what the ORM does, how objects map to tables, the object lifecycle.
> -   [Extbase domain model](https://docs.typo3.org/permalink/t3coreapi:extbase-domain-model@main) — defining models, properties and relation declarations.
> -   [Extbase repository](https://docs.typo3.org/permalink/t3coreapi:extbase-domain-repository@main) — the repository, its find methods and the constraint API.

The pages in this chapter cover:

-   **[Querying the database with Extbase](https://docs.typo3.org/permalink/t3coreapi:extbase-persistence-queries@main)**

    Everything around a query: how to create, constrain and execute them, query
    settings (language, enable fields, deleted records), limiting, ordering and
    pagination, when changes reach the database with `persistAll()`, and how
    to debug a query by inspecting its SQL.

-   **[The storagePid: where Extbase looks for records](https://docs.typo3.org/permalink/t3coreapi:extbase-persistence-storagepid@main)**

    The **storagePid** — the page restriction Extbase applies to every query, and
    the most common reason a query does not return what you expect. The
    resolution chain, the recursive setting, and how to override or drop the
    restriction for a single query.

-   **[Object relations in Extbase](https://docs.typo3.org/permalink/t3coreapi:extbase-persistence-relations@main)**

    The two relation **shapes** — a relation to one object and a relation to many
    — and how each is stored, how Extbase loads related objects, and the **lazy
    loading versus N+1 query** trade-off that decides the performance of a list
    view with relations.
