All Downloads are FREE. Search and download functionalities are using the official Maven repository.

generator.server.pagination.jpa.jpa-pages.md.mustache Maven / Gradle / Ivy

There is a newer version: 1.23.0
Show newest version
# Jpa pages

Let's consider a very common use case to get paginated information from a JPA Spring Repository. In `JpaBeersRepository` we have this method:

```java
Page findAll(Pageable pagination);

```

We can call that this way:

```java
private final JpaBeersRepository beers;

// ...

public FullappPage list(FullappPageable pagination) {
  return FullappPages.from(beers.findAll(FullappPages.from(pagination, Sort.by(Sort.Direction.ASC, "name"))), BeerEntity::toDomain);
}

```

And we'll need a mapping method in `BeerEntity`:

```java
Beer toDomain() {
  // ...
}

```




© 2015 - 2025 Weber Informatics LLC | Privacy Policy