Skip to content

Commit

Permalink
feat: update structure at garage in oracle nosql demo
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <[email protected]>
  • Loading branch information
otaviojava committed Jan 28, 2024
1 parent 86566f7 commit 6bd5723
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions oracle-nosql/src/main/java/org/jnosql/demo/se/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public static void main(String[] args) {
Faker faker = new Faker();
try (SeContainer container = SeContainerInitializer.newInstance().initialize()) {
DocumentTemplate template = container.select(DocumentTemplate.class).get();
for (int index = 0; index < 0; index++) {
for (int index = 0; index < 10; index++) {
Car car = Car.of(faker);
template.insert(car);
}

// template.select(Car.class).stream().toList().forEach(System.out::println);
template.select(Car.class).stream().toList().forEach(System.out::println);
template.select(Car.class).where("transmission").eq("Automatic").orderBy("model").desc()
.stream().forEach(System.out::println);

Expand Down
8 changes: 6 additions & 2 deletions oracle-nosql/src/main/java/org/jnosql/demo/se/App3.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ public static void main(String[] args) {
try (SeContainer container = SeContainerInitializer.newInstance().initialize()) {
Garage repository = container.select(Garage.class, DatabaseQualifier.ofDocument()).get();
for (int index = 0; index < 0; index++) {
Car beer = Car.of(faker);
repository.parking(beer);
Car car = Car.of(faker);
repository.parking(car);
}

Car car = Car.of(faker);
repository.parking(car);
repository.unpark(car);

Pageable page = Pageable.ofPage(1).size(3).sortBy(Sort.desc("model"));
Page<Car> page1 = repository.findByTransmission("CVT", page);
System.out.println("The first page");
Expand Down
2 changes: 1 addition & 1 deletion oracle-nosql/src/main/java/org/jnosql/demo/se/Garage.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public interface Garage extends DataRepository<Car, String>{
Car parking(Car car);

@Delete
void departure(Car car);
void unpark(Car car);

Page<Car> findByTransmission(String transmission, Pageable page);
}

0 comments on commit 6bd5723

Please sign in to comment.