@@ -102,7 +102,11 @@ class FetchableFluentQueryByExample<S, R> extends FluentQuerySupport<S, R> {
|
||||
|
||||
if (scrollPosition instanceof OffsetScrollPosition osp) {
|
||||
|
||||
Query query = createQuery().sort(getSort()).offset(osp.getOffset());
|
||||
Query query = createQuery().sort(getSort());
|
||||
|
||||
if (!osp.isInitial()) {
|
||||
query = query.offset(osp.getOffset() + 1);
|
||||
}
|
||||
|
||||
if (getLimit() > 0) {
|
||||
query = query.limit(getLimit());
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ScrollDelegate {
|
||||
List<T> result = queryFunction.apply(query);
|
||||
|
||||
if (scrollPosition instanceof OffsetScrollPosition offset) {
|
||||
return createWindow(result, limit, OffsetScrollPosition.positionFunction(offset.getOffset()));
|
||||
return createWindow(result, limit, offset.positionFunction());
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException("ScrollPosition " + scrollPosition + " not supported");
|
||||
|
||||
@@ -1137,7 +1137,7 @@ public class JdbcRepositoryIntegrationTests {
|
||||
assertThat(first.map(DummyEntity::getName)).containsExactly("one", "three");
|
||||
|
||||
Window<DummyEntity> second = repository.findBy(example, q -> q.limit(2).sortBy(Sort.by("name")))
|
||||
.scroll(ScrollPosition.offset(2));
|
||||
.scroll(ScrollPosition.offset(1));
|
||||
assertThat(second.map(DummyEntity::getName)).containsExactly("two");
|
||||
|
||||
WindowIterator<DummyEntity> iterator = WindowIterator.of(
|
||||
|
||||
Reference in New Issue
Block a user