Hello Dmitry how are you?
Yeap, it is a bug, I'll submit it as an issue.
What you can do is the Pagination
instance.
@ApplicationScoped
public interface PersonRepository extends Repository<Person, Long> {
List<Person> findAll(Pagination pagination);
}
public class App11 {
public static void main(String[] args) {
try (SeContainer container = SeContainerInitializer.newInstance().initialize()) {
PersonRepository repository = container.select(PersonRepository.class).get();
DocumentTemplate template = container.select(DocumentTemplate.class).get();
template.delete(DocumentDeleteQuery.delete().from("Person").build());
Person otavio = Person.builder().withId(1L)
.withName("Otavio")
.build();
Person poliana = Person.builder().withId(2L)
.withName("Poliana")
.build();
Person elder = Person.builder().withId(3L)
.withName("elder")
.build();
Person yanaga = Person.builder().withId(4L)
.withName("Yanaga")
.build();
repository.save(Arrays.asList(otavio, poliana, elder, yanaga));
List<Person> people = repository.findAll(Pagination.page(1).size(1));
System.out.println("First pagination");
people.forEach(System.out::println);
people = repository.findAll(Pagination.page(2).size(1));
System.out.println("second pagination");
people.forEach(System.out::println);
}
}
}
You can use this demo as a reference: