D
D
DDwrt1002019-06-26 12:08:40
Java
DDwrt100, 2019-06-26 12:08:40

Spring pagination not working with Page?

Good afternoon, for some reason, pagination using Page<> does not work for me.
The class is assembled, the application is started, but there is no pagination in the response body.
All results are simply returned. Although the service information says that everything is fine, so many pages, you are now on the first page.
What am I doing wrong?
Explanation for the code. Through JPA repositories I make a request to two databases. Next, the results are passed to the intermediate code, where everything is collected in an ArrayList. The response from this class is given to the Page formatter, and returned to the controller.

public Page<RESTanswer> giveall(int startPage, int size) {
        PageRequest pagination = PageRequest.of(startPage, size);
        var query1 = DAO1.findAllBy();
        var query2 = DAO2.findAllBy();

        List<RESTQualityTask> RESTList = converterAnswer.REST(query1, query2);
        return new PageImpl<>(RESTList, pagination, RESTList.size());

    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question