-
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
89b4c46
commit 9474fb1
Showing
10 changed files
with
86 additions
and
15 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
oracle-nosql/src/main/java/org/jnosql/demo/se/beer/App.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,44 @@ | ||
/* | ||
* Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Apache License v2.0 which accompanies this distribution. | ||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html | ||
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. | ||
* | ||
* You may elect to redistribute this code under either of these licenses. | ||
*/ | ||
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 App { | ||
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); | ||
} | ||
} | ||
private App() { | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
oracle-nosql/src/main/java/org/jnosql/demo/se/beer/App2.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,34 @@ | ||
/* | ||
* Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Apache License v2.0 which accompanies this distribution. | ||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html | ||
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. | ||
* | ||
* You may elect to redistribute this code under either of these licenses. | ||
*/ | ||
package org.jnosql.demo.se.beer; | ||
|
||
import jakarta.enterprise.inject.se.SeContainer; | ||
import jakarta.enterprise.inject.se.SeContainerInitializer; | ||
import jakarta.nosql.keyvalue.KeyValueTemplate; | ||
import net.datafaker.Faker; | ||
|
||
public class App2 { | ||
|
||
public static void main(String[] args) { | ||
Faker faker = new Faker(); | ||
try (SeContainer container = SeContainerInitializer.newInstance().initialize()) { | ||
KeyValueTemplate template = container.select(KeyValueTemplate.class).get(); | ||
Beer beer = Beer.of(faker); | ||
template.put(beer); | ||
|
||
|
||
System.out.println("The query result: " + template.get(beer.id(), Beer.class)); | ||
template.delete(beer.id()); | ||
System.out.println("The query result: " + template.get(beer.id(), Beer.class)); | ||
} | ||
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
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
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 |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
* | ||
* Otavio Santana | ||
*/ | ||
package org.jnosql.demo.se; | ||
package org.jnosql.demo.se.beer; | ||
|
||
|
||
|
||
|
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
5 changes: 1 addition & 4 deletions
5
...rc/main/java/org/jnosql/demo/se/App2.java → ...ain/java/org/jnosql/demo/se/car/App2.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
2 changes: 1 addition & 1 deletion
2
...rc/main/java/org/jnosql/demo/se/App3.java → ...ain/java/org/jnosql/demo/se/car/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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package org.jnosql.demo.se; | ||
package org.jnosql.demo.se.car; | ||
|
||
|
||
import jakarta.data.Sort; | ||
|
2 changes: 1 addition & 1 deletion
2
...src/main/java/org/jnosql/demo/se/Car.java → ...main/java/org/jnosql/demo/se/car/Car.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
2 changes: 1 addition & 1 deletion
2
.../main/java/org/jnosql/demo/se/Garage.java → ...n/java/org/jnosql/demo/se/car/Garage.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