質問編集履歴
1
ソースコードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -110,6 +110,204 @@
|
|
110
110
|
|
111
111
|
```
|
112
112
|
|
113
|
+
```Entity
|
114
|
+
|
115
|
+
package com.example.person.entity;
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
import javax.persistence.Entity;
|
120
|
+
|
121
|
+
import javax.persistence.GeneratedValue;
|
122
|
+
|
123
|
+
import javax.persistence.GenerationType;
|
124
|
+
|
125
|
+
import javax.persistence.Id;
|
126
|
+
|
127
|
+
import javax.persistence.Table;
|
128
|
+
|
129
|
+
import javax.validation.constraints.Max;
|
130
|
+
|
131
|
+
import javax.validation.constraints.Min;
|
132
|
+
|
133
|
+
import javax.validation.constraints.NotEmpty;
|
134
|
+
|
135
|
+
import javax.validation.constraints.NotNull;
|
136
|
+
|
137
|
+
import javax.validation.constraints.Size;
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
@Entity
|
142
|
+
|
143
|
+
@Table(name="person")
|
144
|
+
|
145
|
+
public class PersonEntity {
|
146
|
+
|
147
|
+
@Id
|
148
|
+
|
149
|
+
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
150
|
+
|
151
|
+
private long id;
|
152
|
+
|
153
|
+
@NotEmpty
|
154
|
+
|
155
|
+
private String name;
|
156
|
+
|
157
|
+
@NotNull
|
158
|
+
|
159
|
+
@Min(value = 0)
|
160
|
+
|
161
|
+
@Max(value = 150)
|
162
|
+
|
163
|
+
private int age;
|
164
|
+
|
165
|
+
@Size(max = 20)
|
166
|
+
|
167
|
+
private String belong;
|
168
|
+
|
169
|
+
private String workplace;
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
public long getId() {
|
174
|
+
|
175
|
+
return id;
|
176
|
+
|
177
|
+
}
|
178
|
+
|
179
|
+
public void setId(long id) {
|
180
|
+
|
181
|
+
this.id = id;
|
182
|
+
|
183
|
+
}
|
184
|
+
|
185
|
+
public String getName() {
|
186
|
+
|
187
|
+
return name;
|
188
|
+
|
189
|
+
}
|
190
|
+
|
191
|
+
public void setName(String name) {
|
192
|
+
|
193
|
+
this.name = name;
|
194
|
+
|
195
|
+
}
|
196
|
+
|
197
|
+
public int getAge() {
|
198
|
+
|
199
|
+
return age;
|
200
|
+
|
201
|
+
}
|
202
|
+
|
203
|
+
public void setAge(int age) {
|
204
|
+
|
205
|
+
this.age = age;
|
206
|
+
|
207
|
+
}
|
208
|
+
|
209
|
+
public String getBelong() {
|
210
|
+
|
211
|
+
return belong;
|
212
|
+
|
213
|
+
}
|
214
|
+
|
215
|
+
public void setTeam(String belong) {
|
216
|
+
|
217
|
+
this.belong = belong;
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
public String getWorkplace() {
|
222
|
+
|
223
|
+
return workplace;
|
224
|
+
|
225
|
+
}
|
226
|
+
|
227
|
+
```
|
228
|
+
|
229
|
+
```pom
|
230
|
+
|
231
|
+
<dependencies>
|
232
|
+
|
233
|
+
<dependency>
|
234
|
+
|
235
|
+
<groupId>org.springframework.boot</groupId>
|
236
|
+
|
237
|
+
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
238
|
+
|
239
|
+
</dependency>
|
240
|
+
|
241
|
+
<dependency>
|
242
|
+
|
243
|
+
<groupId>org.springframework.boot</groupId>
|
244
|
+
|
245
|
+
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
246
|
+
|
247
|
+
</dependency>
|
248
|
+
|
249
|
+
<dependency>
|
250
|
+
|
251
|
+
<groupId>org.springframework.boot</groupId>
|
252
|
+
|
253
|
+
<artifactId>spring-boot-starter-web</artifactId>
|
254
|
+
|
255
|
+
</dependency>
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
<dependency>
|
260
|
+
|
261
|
+
<groupId>org.springframework.boot</groupId>
|
262
|
+
|
263
|
+
<artifactId>spring-boot-devtools</artifactId>
|
264
|
+
|
265
|
+
<scope>runtime</scope>
|
266
|
+
|
267
|
+
</dependency>
|
268
|
+
|
269
|
+
<dependency>
|
270
|
+
|
271
|
+
<groupId>com.h2database</groupId>
|
272
|
+
|
273
|
+
<artifactId>h2</artifactId>
|
274
|
+
|
275
|
+
<scope>runtime</scope>
|
276
|
+
|
277
|
+
</dependency>
|
278
|
+
|
279
|
+
<dependency>
|
280
|
+
|
281
|
+
<groupId>org.springframework.boot</groupId>
|
282
|
+
|
283
|
+
<artifactId>spring-boot-starter-test</artifactId>
|
284
|
+
|
285
|
+
<scope>test</scope>
|
286
|
+
|
287
|
+
</dependency>
|
288
|
+
|
289
|
+
<dependency>
|
290
|
+
|
291
|
+
<groupId>mysql</groupId>
|
292
|
+
|
293
|
+
<artifactId>mysql-connector-java</artifactId>
|
294
|
+
|
295
|
+
<scope>runtime</scope>
|
296
|
+
|
297
|
+
</dependency>
|
298
|
+
|
299
|
+
<dependency>
|
300
|
+
|
301
|
+
<groupId>nz.net.ultraq.thymeleaf</groupId>
|
302
|
+
|
303
|
+
<artifactId>thymeleaf-layout-dialect</artifactId>
|
304
|
+
|
305
|
+
</dependency>
|
306
|
+
|
307
|
+
</dependencies>
|
308
|
+
|
309
|
+
```
|
310
|
+
|
113
311
|
該当しそうなソースコードのみを挙げています。
|
114
312
|
|
115
313
|
他にもありますので、必要な時はご連絡ください。
|