Skip to content

Commit be603a4

Browse files
committed
feat: update vehiclewith static factory
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
1 parent e800050 commit be603a4

2 files changed

Lines changed: 21 additions & 18 deletions

File tree

src/main/java/org/soujava/demos/jakarta/App.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,6 @@ public class App {
2929
public static void main(String[] args) {
3030
var faker = new Faker();
3131
try (SeContainer container = SeContainerInitializer.newInstance().initialize()) {
32-
var template = container.select(DocumentTemplate.class).get();
33-
var electronicsCategory = new Category("Electronics", "All electronics");
34-
var computerCategory = new Category("Computers", "All computers");
35-
var tags = List.of("smartphone", "tablet", "laptop");
36-
var manufacturer = new Manufacturer("Apple", "One Infinite Loop Cupertino, CA 95014", "+1-408-996-1010");
37-
Product macBookPro = Product.builder().categories(Set.of(electronicsCategory, computerCategory))
38-
.manufacturer(manufacturer)
39-
.name("MacBook Pro")
40-
.tags(tags)
41-
.build();
42-
43-
Product product = template.insert(macBookPro);
44-
45-
LOGGER.info("Product saved: " + product);
46-
template.select(Product.class).where("id")
47-
.eq(product.getId())
48-
.result().forEach(p -> LOGGER.info("Product found: " + p));
49-
5032

5133
}
5234
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package org.soujava.demos.jakarta;
2+
3+
import jakarta.nosql.Column;
4+
import jakarta.nosql.Entity;
5+
import jakarta.nosql.Id;
6+
import net.datafaker.Faker;
7+
8+
@Entity
9+
public class Vehicle {
10+
11+
@Id
12+
private String id;
13+
@Column
14+
private String model;
15+
16+
17+
18+
public static Vehicle of(Faker faker) {
19+
20+
}
21+
}

0 commit comments

Comments
 (0)