Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jdbc.core.convert.DataAccessStrategy;
Expand All @@ -39,6 +38,7 @@
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
import org.springframework.data.relational.core.mapping.event.*;
import org.springframework.data.support.PageableExecutionUtils;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;

Expand All @@ -50,6 +50,7 @@
* @author Thomas Lang
* @author Christoph Strobl
* @author Milan Milanov
* @author Myeonghyeon Lee
*/
public class JdbcAggregateTemplate implements JdbcAggregateOperations {

Expand Down Expand Up @@ -248,10 +249,9 @@ public <T> Page<T> findAll(Class<T> domainType, Pageable pageable) {
Assert.notNull(domainType, "Domain type must not be null!");

Iterable<T> items = triggerAfterLoad(accessStrategy.findAll(domainType, pageable));
long totalCount = accessStrategy.count(domainType);
List<T> content = StreamSupport.stream(items.spliterator(), false).collect(Collectors.toList());

return new PageImpl<>(StreamSupport.stream(items.spliterator(), false).collect(Collectors.toList()), pageable,
totalCount);
return PageableExecutionUtils.getPage(content, pageable, () -> accessStrategy.count(domainType));
}

/*
Expand Down