When I hit the database with PagingAndSortingRepository.findAll(Pageable)
I get Page
. However, I want to expose DTO\'s to the clien
In Spring Data 2, the Page map method takes a Function instead of a Converter, but it still works basically the same as @Ali Dehghani described.
Using Function:
Page entities = objectEntityRepository.findAll(pageable);
Page dtoPage = entities.map(new Function() {
@Override
public ObjectDto apply(ObjectEntity entity) {
ObjectDto dto = new ObjectDto();
// Conversion logic
return dto;
}
});