You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let Java classes be mapped into database tables. extends ``DataSupport`` class. The fields ``id``, ``createdAt``, and ``updatedAt`` are internal fields, please read them only when using them.
44
45
```java
45
-
publicclassUser {
46
-
publicLong id;
46
+
publicstaticclassUserextendsDataSupport<User> {
47
47
publicString name;
48
48
publicInteger age;
49
49
publicBoolean vip;
50
50
51
51
publicUser(Consumer<User>consumer) {
52
-
consumer.accept(this);
52
+
super(consumer);
53
53
}
54
54
}
55
55
56
-
publicclassBook {
57
-
publicLong id;
56
+
57
+
publicclassBookextendsDataSupport<Book> {
58
58
publicString name;
59
59
publicString author;
60
60
publicDouble price;
61
61
62
62
publicBook(Consumer<Book>consumer) {
63
-
consumer.accept(this);
63
+
super(consumer);
64
64
}
65
65
}
66
66
```
@@ -76,7 +76,7 @@ Insert data.
76
76
// No need to set ID, ID will increase automatically when inserting data.
77
77
User user =newUser(u -> {u.name ="Lake"; u.age =25; u.vip =true;});
0 commit comments