Skip to content

Commit 6ef0345

Browse files
committed
feat: query app
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
1 parent cc79e57 commit 6ef0345

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright (c) 2022 Contributors to the Eclipse Foundation
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* and Apache License v2.0 which accompanies this distribution.
6+
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7+
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
8+
*
9+
* You may elect to redistribute this code under either of these licenses.
10+
*/
11+
12+
package org.soujava.demos.jakarta;
13+
14+
15+
import jakarta.data.page.PageRequest;
16+
import jakarta.enterprise.inject.se.SeContainer;
17+
import jakarta.enterprise.inject.se.SeContainerInitializer;
18+
import net.datafaker.Faker;
19+
20+
import java.util.logging.Logger;
21+
22+
23+
public class QueryApp {
24+
25+
private static final Logger LOGGER = Logger.getLogger(QueryApp.class.getName());
26+
27+
public static void main(String[] args) {
28+
var faker = new Faker();
29+
try (SeContainer container = SeContainerInitializer.newInstance().initialize()) {
30+
var garage = container.select(Garage.class).get();
31+
32+
for (int index = 0; index < 10; index++) {
33+
garage.park(Vehicle.of(faker));
34+
}
35+
36+
var cursor = garage.cursor(Transmission.AUTOMATIC, PageRequest.ofSize(3));
37+
38+
System.out.println("the cursor has next page: " + cursor.content());
39+
var cursor2 = garage.cursor(Transmission.AUTOMATIC, cursor.nextPageRequest());
40+
System.out.println("the cursor2 has next page: " + cursor2.content());
41+
42+
}
43+
}
44+
45+
private QueryApp() {
46+
}
47+
}

0 commit comments

Comments
 (0)