Top Description Interfaces Annotations
module jakarta.data

Package jakarta.data.repository


A repository is an interface annotated with jakarta.data.repository.Repository that defines operations on entities. Entities represent data in the persistent store. In Domain-driven design, a repository participates in the domain but abstracts away storage and infrastructure details.

Repository interfaces can optionally inherit from built-in interfaces within this package,

Repository interfaces can also define their own lifecycle methods using the jakarta.data.repository.Insert, jakarta.data.repository.Update, jakarta.data.repository.Save, and jakarta.data.repository.Delete annotations, as well as a variety of other methods following the Query by Method Name pattern, the Parameter-based Conditions pattern, and the jakarta.data.repository.Query annotation.

The module Javadoc provides an overview of Jakarta Data.

Interface Summary

Modifier and TypeInterface and Description
public interface
BasicRepository<
the type of the primary entity class of the repository.
T
,
the type of the unique identifier attribute of the primary entity.
K
>

A built-in repository supertype for performing basic operations on entities.

public interface
CrudRepository<
the type of the primary entity class of the repository.
T
,
the type of the unique identifier field of property of the primary entity.
K
>

A built-in repository supertype for performing Create, Read, Update, and Delete (CRUD) operations.

public interface
DataRepository<
the type of the primary entity class of the repository.
T
,
the type of the unique identifier field of property of the primary entity.
K
>

A built-in repository supertype that is the root of all other built-in repository supertype interfaces.

Annotation Summary

Modifier and TypeAnnotation and Description
public @interface
By

Annotates a parameter of a repository method, specifying a mapping to a persistent field:

  • if a field name is specified, the parameter maps to the persistent field with the specified name, or
  • if the special value id(this) is specified, the parameter maps to the unique identifier field or property.
public @interface
Delete

Lifecycle annotation for repository methods which perform delete operations; alternatively, annotates a repository method as a parameter-based automatic query method which deletes entities.

public @interface
Find

Annotates a repository method returning entities as a parameter-based automatic query method.

public @interface
Insert

Lifecycle annotation for repository methods which perform insert operations.

public @interface
OrderBy

Annotates a repository method to request sorting of results.

public @interface
Param

Annotates a parameter of a repository method to bind it to a named parameter of a Query.

public @interface
Query

Annotates a repository method as a query method, specifying a query written in Jakarta Data Query Language (JDQL) or in Jakarta Persistence Query Language (JPQL).

public @interface
Repository

Annotates a repository interface to be implemented by the container/runtime.

public @interface
Save

Lifecycle annotation for repository methods which conditionally perform insert or update operations.

public @interface
Update

Lifecycle annotation for repository methods which perform update operations.