Annotation Type Repository


  • @Retention(RUNTIME)
    @Target(TYPE)
    @Documented
    public @interface Repository
    Identifies a Repository. Repositories simulate a collection of aggregates to which aggregate instances can be added and removed. They usually also expose API to select a subset of aggregates matching certain criteria. Access to projections of an aggregate might be provided as well but also via a dedicated separate abstraction.

    Implementations use a dedicated persistence mechanism appropriate to the data structure and query requirements at hand. However, they should make sure that no persistence mechanism specific APIs leak into client code.

    See Also:
    AggregateRoot, Domain-Driven Design Reference (Evans) - Repositories