-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Otavio Santana <[email protected]>
- Loading branch information
1 parent
9474fb1
commit 01f45d1
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
oracle-nosql/src/main/java/org/jnosql/demo/se/beer/App3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ public String name() { | |
} | ||
|
||
|
||
Crew() { | ||
public Crew() { | ||
} | ||
|
||
Crew(String name) { | ||
|