terminal

codeando_simple

terminal

menu

terminal

search_module

guest@codeandosimple: ~/system/search $ grep -r "" .

Press [ENTER] to execute search

Status

Engine: Ready

Database: Online

Index: V2.1.0_LATEST

bash -- cat repository.md
guest@codeandosimple: ~/enterprise/patterns $ cat repository.md

Repository_

// "Abstracting data access as if it were a collection"

The **Repository** pattern acts as a mediator between the domain and data mapping layers. It provides an interface that behaves like an in-memory collection of objects.

Its goal is to hide the details of the persistence infrastructure (SQL, NoSQL, external APIs) and allow business logic to work with simple domain objects.

# Difference with DAO

While a **DAO** (Data Access Object) is typically a direct abstraction over a database table, a **Repository** is a higher-level abstraction oriented towards the domain. It may use multiple DAOs internally to reconstruct a complex object (Aggregate).

# Common Implementation

public interface CustomerRepository {
    void add(Customer customer);
    void remove(Customer customer);
    Customer findById(String id);
    List<Customer> findByStatus(Status status);
}