File tree Expand file tree Collapse file tree 1 file changed +54
-1
lines changed
src/main/java/org/soujava/demos/mongodb/document Expand file tree Collapse file tree 1 file changed +54
-1
lines changed Original file line number Diff line number Diff line change 1
1
package org .soujava .demos .mongodb .document ;
2
2
3
+ import jakarta .json .bind .annotation .JsonbVisibility ;
4
+ import jakarta .nosql .Column ;
5
+ import jakarta .nosql .Convert ;
6
+ import jakarta .nosql .Entity ;
7
+ import jakarta .nosql .Id ;
8
+ import org .eclipse .jnosql .databases .mongodb .mapping .ObjectIdConverter ;
9
+
10
+ import java .util .List ;
11
+ import java .util .Objects ;
12
+ import java .util .Set ;
13
+
14
+ @ Entity
3
15
public class Product {
4
- }
16
+
17
+ @ Id
18
+ @ Convert (ObjectIdConverter .class )
19
+ private String id ;
20
+
21
+ @ Column
22
+ private String name ;
23
+
24
+ @ Column
25
+ private Manufacturer manufacturer ;
26
+
27
+ @ Column
28
+ private List <String > tags ;
29
+
30
+ @ Column
31
+ private Set <Category > categories ;
32
+
33
+ @ Override
34
+ public boolean equals (Object o ) {
35
+ if (o == null || getClass () != o .getClass ()) {
36
+ return false ;
37
+ }
38
+ Product product = (Product ) o ;
39
+ return Objects .equals (id , product .id );
40
+ }
41
+
42
+ @ Override
43
+ public int hashCode () {
44
+ return Objects .hashCode (id );
45
+ }
46
+
47
+ @ Override
48
+ public String toString () {
49
+ return "Product{" +
50
+ "id='" + id + '\'' +
51
+ ", name='" + name + '\'' +
52
+ ", manufacturer=" + manufacturer +
53
+ ", tags=" + tags +
54
+ ", categories=" + categories +
55
+ '}' ;
56
+ }
57
+ }
You can’t perform that action at this time.
0 commit comments