use of org.springframework.data.querydsl.QPageRequest in project kylo by Teradata.
the class QueryDslPagingSupport method findAll.
protected Page<E> findAll(JPAQuery query, Pageable pageable) {
if (pageable == null) {
pageable = new QPageRequest(0, Integer.MAX_VALUE);
}
long total = query.clone(super.getEntityManager()).fetchCount();
JPQLQuery pagedQuery = getQuerydsl().applyPagination(pageable, query);
List<E> content = total > pageable.getOffset() ? pagedQuery.fetch() : Collections.<E>emptyList();
return new PageImpl<>(content, pageable, total);
}
use of org.springframework.data.querydsl.QPageRequest in project kylo by Teradata.
the class QueryDslPagingSupport method findAllWithFetch.
public Page<E> findAllWithFetch(EntityPathBase<E> path, Predicate predicate, boolean distinct, Pageable pageable, QueryDslFetchJoin... joins) {
if (pageable == null) {
pageable = new QPageRequest(0, Integer.MAX_VALUE);
}
long total = createFetchQuery(path, predicate, distinct, joins).fetchCount();
JPQLQuery pagedQuery = getQuerydsl().applyPagination(pageable, createFetchQuery(path, predicate, distinct, joins));
List<E> content = total > pageable.getOffset() ? pagedQuery.fetch() : Collections.<E>emptyList();
return new PageImpl<>(content, pageable, total);
}
Aggregations