Skip to content

Commit

Permalink
feat: create constructor
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <[email protected]>
  • Loading branch information
otaviojava committed Feb 1, 2024
1 parent 9474fb1 commit 01f45d1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
37 changes: 37 additions & 0 deletions oracle-nosql/src/main/java/org/jnosql/demo/se/beer/App3.java
Original file line number Diff line number Diff line change
@@ -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<Beer> 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<Beer> page2 = repository.findAll(secondPage);
page2.forEach(System.out::println);

System.out.println("The query result: ");
repository.query().forEach(System.out::println);
}

System.exit(0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public String name() {
}


Crew() {
public Crew() {
}

Crew(String name) {
Expand Down

0 comments on commit 01f45d1

Please sign in to comment.