File tree Expand file tree Collapse file tree 7 files changed +156
-0
lines changed
src/main/java/com/iluwatar/activerecord Expand file tree Collapse file tree 7 files changed +156
-0
lines changed Original file line number Diff line number Diff line change
1
+ --- # this is so-called 'YAML front matter' used to categorize the patterns and format the web pages. Fill it as follows:
2
+ title: Best Pattern Ever # the properly formatted title
3
+ category: Creational # usable categories and tags are listed here: https://github.com/iluwatar/java-design-patterns/wiki/07.-Categories-and-Tags
4
+ language: en # Provide the language in which the pattern is done. Mostly it is in English, so we would put * en* over here.
5
+ tag:
6
+ - awesome # usable categories and tags are listed here: https://github.com/iluwatar/java-design-patterns/wiki/07.-Categories-and-Tags
7
+ - blue
8
+ ---
9
+
10
+ ## Name / classification
11
+
12
+ ## Also known as
13
+
14
+ ## Intent
15
+
16
+ ## Explanation
17
+
18
+ ## Class diagram
19
+
20
+ ## Applicability
21
+
22
+ ## Tutorials
23
+
24
+ ## Known uses
25
+
26
+ ## Consequences
27
+
28
+ ## Related patterns
29
+
30
+ ## Credits
Original file line number Diff line number Diff line change
1
+ @startuml
2
+
3
+ @enduml
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5
+ <modelVersion >4.0.0</modelVersion >
6
+ <parent >
7
+ <groupId >com.iluwatar</groupId >
8
+ <artifactId >java-design-patterns</artifactId >
9
+ <version >1.26.0-SNAPSHOT</version >
10
+ </parent >
11
+
12
+ <artifactId >active-record</artifactId >
13
+
14
+ <properties >
15
+ <maven .compiler.source>17</maven .compiler.source>
16
+ <maven .compiler.target>17</maven .compiler.target>
17
+ <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
18
+ </properties >
19
+
20
+ <dependencies >
21
+ <dependency >
22
+ <groupId >org.junit.jupiter</groupId >
23
+ <artifactId >junit-jupiter-engine</artifactId >
24
+ <scope >test</scope >
25
+ </dependency >
26
+ <dependency >
27
+ <groupId >com.h2database</groupId >
28
+ <artifactId >h2</artifactId >
29
+ </dependency >
30
+ <dependency >
31
+ <groupId >org.mockito</groupId >
32
+ <artifactId >mockito-core</artifactId >
33
+ <scope >test</scope >
34
+ </dependency >
35
+ </dependencies >
36
+ <build >
37
+ <plugins >
38
+ <plugin >
39
+ <groupId >org.apache.maven.plugins</groupId >
40
+ <artifactId >maven-assembly-plugin</artifactId >
41
+ <executions >
42
+ <execution >
43
+ <configuration >
44
+ <archive >
45
+ <manifest >
46
+ <mainClass >com.iluwatar.dao.App</mainClass >
47
+ </manifest >
48
+ </archive >
49
+ </configuration >
50
+ </execution >
51
+ </executions >
52
+ </plugin >
53
+ </plugins >
54
+ </build >
55
+
56
+ </project >
Original file line number Diff line number Diff line change
1
+ package com .iluwatar .activerecord ;
2
+
3
+ import java .util .List ;
4
+ import lombok .EqualsAndHashCode ;
5
+ import lombok .Getter ;
6
+ import lombok .RequiredArgsConstructor ;
7
+ import lombok .Setter ;
8
+
9
+ @ Getter
10
+ @ Setter
11
+ @ RequiredArgsConstructor
12
+ @ EqualsAndHashCode (onlyExplicitlyIncluded = true )
13
+ public class Customer {
14
+
15
+ private Long id ;
16
+ private String customerNumber ;
17
+ private String firstName ;
18
+ private String lastName ;
19
+ private List <Order > orders ;
20
+
21
+ public Customer findById (Long id ) {
22
+ return new Customer ();
23
+ }
24
+
25
+ public Customer findByNumber (String customerNumber ) {
26
+ return new Customer ();
27
+ }
28
+
29
+ public List <Customer > findAll () {
30
+ return List .of ();
31
+ }
32
+
33
+ public void save (Customer customer ) {
34
+
35
+ }
36
+
37
+ }
Original file line number Diff line number Diff line change
1
+ package com .iluwatar .activerecord ;
2
+
3
+ import lombok .AllArgsConstructor ;
4
+ import lombok .EqualsAndHashCode ;
5
+ import lombok .Getter ;
6
+ import lombok .NoArgsConstructor ;
7
+ import lombok .Setter ;
8
+
9
+ @ Getter
10
+ @ Setter
11
+ @ EqualsAndHashCode (onlyExplicitlyIncluded = true )
12
+ @ NoArgsConstructor
13
+ @ AllArgsConstructor
14
+ public class Order {
15
+
16
+ private Long id ;
17
+ private String orderNumber ;
18
+ }
Original file line number Diff line number Diff line change
1
+ package com .iluwatar .activerecord ;
2
+
3
+ import javax .sql .DataSource ;
4
+ import lombok .RequiredArgsConstructor ;
5
+
6
+ @ RequiredArgsConstructor
7
+ public abstract class RecordBase {
8
+
9
+ private final DataSource dataSource ;
10
+
11
+ }
Original file line number Diff line number Diff line change 215
215
<module >single-table-inheritance</module >
216
216
<module >dynamic-proxy</module >
217
217
<module >gateway</module >
218
+ <module >active-record</module >
218
219
</modules >
219
220
<repositories >
220
221
<repository >
You can’t perform that action at this time.
0 commit comments