質問編集履歴
1
ソースコードの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -54,6 +54,105 @@
|
|
54
54
|
}
|
55
55
|
}
|
56
56
|
```
|
57
|
+
```Entity
|
58
|
+
package com.example.person.entity;
|
59
|
+
|
60
|
+
import javax.persistence.Entity;
|
61
|
+
import javax.persistence.GeneratedValue;
|
62
|
+
import javax.persistence.GenerationType;
|
63
|
+
import javax.persistence.Id;
|
64
|
+
import javax.persistence.Table;
|
65
|
+
import javax.validation.constraints.Max;
|
66
|
+
import javax.validation.constraints.Min;
|
67
|
+
import javax.validation.constraints.NotEmpty;
|
68
|
+
import javax.validation.constraints.NotNull;
|
69
|
+
import javax.validation.constraints.Size;
|
70
|
+
|
71
|
+
@Entity
|
72
|
+
@Table(name="person")
|
73
|
+
public class PersonEntity {
|
74
|
+
@Id
|
75
|
+
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
76
|
+
private long id;
|
77
|
+
@NotEmpty
|
78
|
+
private String name;
|
79
|
+
@NotNull
|
80
|
+
@Min(value = 0)
|
81
|
+
@Max(value = 150)
|
82
|
+
private int age;
|
83
|
+
@Size(max = 20)
|
84
|
+
private String belong;
|
85
|
+
private String workplace;
|
86
|
+
|
87
|
+
public long getId() {
|
88
|
+
return id;
|
89
|
+
}
|
90
|
+
public void setId(long id) {
|
91
|
+
this.id = id;
|
92
|
+
}
|
93
|
+
public String getName() {
|
94
|
+
return name;
|
95
|
+
}
|
96
|
+
public void setName(String name) {
|
97
|
+
this.name = name;
|
98
|
+
}
|
99
|
+
public int getAge() {
|
100
|
+
return age;
|
101
|
+
}
|
102
|
+
public void setAge(int age) {
|
103
|
+
this.age = age;
|
104
|
+
}
|
105
|
+
public String getBelong() {
|
106
|
+
return belong;
|
107
|
+
}
|
108
|
+
public void setTeam(String belong) {
|
109
|
+
this.belong = belong;
|
110
|
+
}
|
111
|
+
public String getWorkplace() {
|
112
|
+
return workplace;
|
113
|
+
}
|
114
|
+
```
|
115
|
+
```pom
|
116
|
+
<dependencies>
|
117
|
+
<dependency>
|
118
|
+
<groupId>org.springframework.boot</groupId>
|
119
|
+
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
120
|
+
</dependency>
|
121
|
+
<dependency>
|
122
|
+
<groupId>org.springframework.boot</groupId>
|
123
|
+
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
124
|
+
</dependency>
|
125
|
+
<dependency>
|
126
|
+
<groupId>org.springframework.boot</groupId>
|
127
|
+
<artifactId>spring-boot-starter-web</artifactId>
|
128
|
+
</dependency>
|
129
|
+
|
130
|
+
<dependency>
|
131
|
+
<groupId>org.springframework.boot</groupId>
|
132
|
+
<artifactId>spring-boot-devtools</artifactId>
|
133
|
+
<scope>runtime</scope>
|
134
|
+
</dependency>
|
135
|
+
<dependency>
|
136
|
+
<groupId>com.h2database</groupId>
|
137
|
+
<artifactId>h2</artifactId>
|
138
|
+
<scope>runtime</scope>
|
139
|
+
</dependency>
|
140
|
+
<dependency>
|
141
|
+
<groupId>org.springframework.boot</groupId>
|
142
|
+
<artifactId>spring-boot-starter-test</artifactId>
|
143
|
+
<scope>test</scope>
|
144
|
+
</dependency>
|
145
|
+
<dependency>
|
146
|
+
<groupId>mysql</groupId>
|
147
|
+
<artifactId>mysql-connector-java</artifactId>
|
148
|
+
<scope>runtime</scope>
|
149
|
+
</dependency>
|
150
|
+
<dependency>
|
151
|
+
<groupId>nz.net.ultraq.thymeleaf</groupId>
|
152
|
+
<artifactId>thymeleaf-layout-dialect</artifactId>
|
153
|
+
</dependency>
|
154
|
+
</dependencies>
|
155
|
+
```
|
57
156
|
該当しそうなソースコードのみを挙げています。
|
58
157
|
他にもありますので、必要な時はご連絡ください。
|
59
158
|
|