Question: How can I get all the records for `findAll ()` service using pagination and `Spring Data JPA` when we do not apply filters it should return all the records rather than displaying it pagewise.I have `findAll (Pageable pageable)` service and calling it from custom repository. IS it possible to get all the records in one page only using pagination?

Answer: 
Now PageRequest constructor is protected and you cannot create with 'new'.
You have to call static method:

```
PageRequest.of(int page, int size)
PageRequest.of(int page, int size, @NotNull Sort sort)
PageRequest.of(int page, int size, @NotNull Direction direction, @NotNull String... properties)

```

And solution looks like:

```
Page<User> users = repository.findAll(PageRequest.of(0, 20));

```

And of course your UserRepository interface should be extends from PagingAndSortingRepository:

```
public interface UserRepository extends PagingAndSortingRepository<User, Long>

```
Use `CrudRepository` instead of `PagingAndSortingRepository` if you don't need paging