Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance documentation readme file #748

Merged
merged 4 commits into from
May 31, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,26 @@ Whether you use built-in repository interfaces or create custom repositories, Ja

==== Pagination

Jakarta Data also supports parameters to define pagination and sorting.
Jakarta Data supports two types of Pagination: offset and cursor-based Pagination.

- **Offset Pagination**: Offset-based pagination relies on the LIMIT clause to tell the database to skip a certain number of rows before returning a specific number of rows.
otaviojava marked this conversation as resolved.
Show resolved Hide resolved

- **Cursor-based Pagination**: Cursor-based Pagination aims to reduce missed and duplicate results across pages by querying relative to the observed values of entity properties that constitute the sorting criteria. This method uses a cursor, a pointer to a specific position in the dataset, to navigate the dataset.

Example code using both pagination methods:

[source,java]
----

@Repository
public interface CarRepository extends BasicRepository<Car, Long> {

Page<Car> findByTypeOrderByName(CarType type, PageRequest pageRequest);

@Find
@OrderBy(_Car.NAME)
otaviojava marked this conversation as resolved.
Show resolved Hide resolved
@OrderBy(_Car.VIN)
CursoredPage<Car> type(CarType type, PageRequest pageRequest);

}
----

Expand Down