File tree 2 files changed +23
-3
lines changed
active-record/src/main/java/com/iluwatar/activerecord 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 1
1
package com .iluwatar .activerecord ;
2
2
3
+ import java .sql .PreparedStatement ;
4
+ import java .sql .ResultSet ;
5
+ import java .sql .SQLException ;
3
6
import lombok .AllArgsConstructor ;
4
- import lombok .EqualsAndHashCode ;
5
7
import lombok .Getter ;
6
8
import lombok .NoArgsConstructor ;
7
9
import lombok .Setter ;
11
13
*/
12
14
@ Getter
13
15
@ Setter
14
- @ EqualsAndHashCode (onlyExplicitlyIncluded = true )
15
16
@ NoArgsConstructor
16
17
@ AllArgsConstructor
17
- public class Order {
18
+ public class Order extends RecordBase < Order > {
18
19
19
20
private Long id ;
20
21
private String orderNumber ;
22
+
23
+ @ Override
24
+ protected String getTableName () {
25
+ return "order" ;
26
+ }
27
+
28
+ @ Override
29
+ protected void setFieldsFromResultSet (ResultSet rs ) throws SQLException {
30
+ this .id = rs .getLong ("id" );
31
+ this .orderNumber = rs .getString ("order_number" );
32
+ }
33
+
34
+ @ Override
35
+ protected void setPreparedStatementParams (PreparedStatement pstmt ) throws SQLException {
36
+ // TODO
37
+ }
21
38
}
Original file line number Diff line number Diff line change 13
13
14
14
/**
15
15
* An active record base supposed to hold all the necessary active record pattern logic.
16
+ * <p>
17
+ * This is the base class which is supposed to be extended by all the domain models that are
18
+ * expected to be persistent.
16
19
*
17
20
* @param <T> an active record type.
18
21
*/
You can’t perform that action at this time.
0 commit comments