@@ -23,7 +23,7 @@ We need to insert a single record to the table.
23
23
movieStore
24
24
.insert()
25
25
.values(new Movie(null, "Inception", "Christopher Nolan"))
26
- .execute();
26
+ .execute(dataSource );
27
27
```
28
28
29
29
We need to insert multiple records to the table.
@@ -46,7 +46,7 @@ movieStore
46
46
new Movie (null , " Fight Club" , " David Fincher" ),
47
47
new Movie (null , " Interstellar" , " Christopher Nolan" ),
48
48
new Movie (null , " The Social Network" , " David Fincher" ))
49
- .execute();
49
+ .execute(dataSource );
50
50
```
51
51
52
52
We need to insert a single record to the table and return inserted value.
@@ -65,7 +65,7 @@ We need to select all the movies
65
65
``` java
66
66
List<Movie > movies = movieStore
67
67
.select()
68
- .execute();
68
+ .execute(dataSource );
69
69
```
70
70
71
71
We need to select the movies with where clause
@@ -74,7 +74,25 @@ We need to select the movies with where clause
74
74
List<Movie > movies = movieStore
75
75
.select()
76
76
.where(directedBy(). eq(" Christopher Nolan" ))
77
- .execute();
77
+ .execute(dataSource);
78
+ ```
79
+
80
+ We need to select a movie by primary key (id columns)
81
+
82
+ ``` java
83
+ Movie movie = movieStore
84
+ .select()
85
+ .execute(dataSource);
86
+ ```
87
+
88
+
89
+ We need to select a movie by primary key (id columns) with where clause
90
+
91
+ ``` java
92
+ Movie movie = movieStore
93
+ .select()
94
+ .where(directedBy(). eq(" Christopher Nolan" ))
95
+ .execute(dataSource);
78
96
```
79
97
80
98
## Update
@@ -90,7 +108,7 @@ movieStore
90
108
.update()
91
109
.set(new Movie (null , " Fight Club" , " Martyn Scorsese" ))
92
110
.where(title(). eq(" Fight Club" ))
93
- .execute();
111
+ .execute(dataSource );
94
112
```
95
113
96
114
Update a record with multiple where clause
@@ -106,7 +124,7 @@ movieStore
106
124
.where(
107
125
id(). eq(1 ). and()
108
126
.title(). eq(" Fight Club" ))
109
- .execute();
127
+ .execute(dataSource );
110
128
```
111
129
112
130
Update a record with multiple where clause amd selected columns
@@ -119,7 +137,7 @@ movieStore
119
137
.update()
120
138
.set(directedBy(" Martyn Scorsese" ))
121
139
.where(id(). eq(1 ). and(). title(). eq(" Fight Club" ))
122
- .execute();
140
+ .execute(dataSource );
123
141
```
124
142
125
143
@@ -130,6 +148,15 @@ Delete all the records in the table
130
148
``` java
131
149
movieStore
132
150
.delete()
133
- .execute();
151
+ .execute(dataSource );
134
152
```
135
153
154
+
155
+ We need to delete the movies with where clause
156
+
157
+ ``` java
158
+ movieStore
159
+ .delete()
160
+ .where(directedBy(). eq(" Christopher Nolan" ))
161
+ .execute(dataSource);
162
+ ```
0 commit comments