diff --git a/oracle-nosql/src/main/java/org/jnosql/demo/se/beer/App3.java b/oracle-nosql/src/main/java/org/jnosql/demo/se/beer/App3.java new file mode 100644 index 00000000..3ba3e69f --- /dev/null +++ b/oracle-nosql/src/main/java/org/jnosql/demo/se/beer/App3.java @@ -0,0 +1,37 @@ +package org.jnosql.demo.se.beer; + +import jakarta.data.Sort; +import jakarta.data.page.Page; +import jakarta.data.page.Pageable; +import jakarta.enterprise.inject.se.SeContainer; +import jakarta.enterprise.inject.se.SeContainerInitializer; +import net.datafaker.Faker; + +public class App3 { + + public static void main(String[] args) { + Faker faker = new Faker(); + try (SeContainer container = SeContainerInitializer.newInstance().initialize()) { + BeerRepository repository = container.select(BeerRepository.class).get(); + for (int index = 0; index < 100; index++) { + Beer beer = Beer.of(faker); + repository.save(beer); + + } + + Pageable page = Pageable.ofPage(1).sortBy(Sort.desc("style")); + Page page1 = repository.findAll(page); + System.out.println("The first page"); + page1.forEach(System.out::println); + System.out.println("The second page"); + Pageable secondPage = page.next(); + Page page2 = repository.findAll(secondPage); + page2.forEach(System.out::println); + + System.out.println("The query result: "); + repository.query().forEach(System.out::println); + } + + System.exit(0); + } +} diff --git a/oracle-nosql/src/main/java/org/jnosql/demo/se/beer/Crew.java b/oracle-nosql/src/main/java/org/jnosql/demo/se/beer/Crew.java index 5b625cc4..053116ff 100644 --- a/oracle-nosql/src/main/java/org/jnosql/demo/se/beer/Crew.java +++ b/oracle-nosql/src/main/java/org/jnosql/demo/se/beer/Crew.java @@ -32,7 +32,7 @@ public String name() { } - Crew() { + public Crew() { } Crew(String name) {