質問編集履歴
1
ソースコードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -34,7 +34,175 @@
|
|
34
34
|
|
35
35
|
```
|
36
36
|
|
37
|
-
|
37
|
+
###pom.xml
|
38
|
+
|
39
|
+
```
|
40
|
+
|
41
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
42
|
+
|
43
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
44
|
+
|
45
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
46
|
+
|
47
|
+
<modelVersion>4.0.0</modelVersion>
|
48
|
+
|
49
|
+
<parent>
|
50
|
+
|
51
|
+
<groupId>org.springframework.boot</groupId>
|
52
|
+
|
53
|
+
<artifactId>spring-boot-starter-parent</artifactId>
|
54
|
+
|
55
|
+
<version>2.2.4.RELEASE</version>
|
56
|
+
|
57
|
+
<relativePath/> <!-- lookup parent from repository -->
|
58
|
+
|
59
|
+
</parent>
|
60
|
+
|
61
|
+
<groupId>com.example</groupId>
|
62
|
+
|
63
|
+
<artifactId>hajiboot-jpa</artifactId>
|
64
|
+
|
65
|
+
<version>0.0.1-SNAPSHOT</version>
|
66
|
+
|
67
|
+
<name>hajiboot-jpa</name>
|
68
|
+
|
69
|
+
<description>Demo project for Spring Boot</description>
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<properties>
|
74
|
+
|
75
|
+
<java.version>1.8</java.version>
|
76
|
+
|
77
|
+
</properties>
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dependencies>
|
82
|
+
|
83
|
+
<dependency>
|
84
|
+
|
85
|
+
<groupId>org.springframework.boot</groupId>
|
86
|
+
|
87
|
+
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
88
|
+
|
89
|
+
</dependency>
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<dependency>
|
94
|
+
|
95
|
+
<groupId>com.h2database</groupId>
|
96
|
+
|
97
|
+
<artifactId>h2</artifactId>
|
98
|
+
|
99
|
+
<scope>runtime</scope>
|
100
|
+
|
101
|
+
</dependency>
|
102
|
+
|
103
|
+
<dependency>
|
104
|
+
|
105
|
+
<groupId>org.projectlombok</groupId>
|
106
|
+
|
107
|
+
<artifactId>lombok</artifactId>
|
108
|
+
|
109
|
+
<optional>true</optional>
|
110
|
+
|
111
|
+
</dependency>
|
112
|
+
|
113
|
+
<dependency>
|
114
|
+
|
115
|
+
<groupId>org.springframework.boot</groupId>
|
116
|
+
|
117
|
+
<artifactId>spring-boot-starter-test</artifactId>
|
118
|
+
|
119
|
+
<scope>test</scope>
|
120
|
+
|
121
|
+
<exclusions>
|
122
|
+
|
123
|
+
<exclusion>
|
124
|
+
|
125
|
+
<groupId>org.junit.vintage</groupId>
|
126
|
+
|
127
|
+
<artifactId>junit-vintage-engine</artifactId>
|
128
|
+
|
129
|
+
</exclusion>
|
130
|
+
|
131
|
+
</exclusions>
|
132
|
+
|
133
|
+
</dependency>
|
134
|
+
|
135
|
+
<dependency>
|
136
|
+
|
137
|
+
<groupId>org.lazyluke</groupId>
|
138
|
+
|
139
|
+
<artifactId>log4jdbc-remix</artifactId>
|
140
|
+
|
141
|
+
<version>0.2.7</version>
|
142
|
+
|
143
|
+
</dependency>
|
144
|
+
|
145
|
+
</dependencies>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<build>
|
150
|
+
|
151
|
+
<plugins>
|
152
|
+
|
153
|
+
<plugin>
|
154
|
+
|
155
|
+
<groupId>org.springframework.boot</groupId>
|
156
|
+
|
157
|
+
<artifactId>spring-boot-maven-plugin</artifactId>
|
158
|
+
|
159
|
+
</plugin>
|
160
|
+
|
161
|
+
</plugins>
|
162
|
+
|
163
|
+
</build>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
</project>
|
168
|
+
|
169
|
+
```
|
170
|
+
|
171
|
+
###CustomerRepository.java
|
172
|
+
|
173
|
+
```java
|
174
|
+
|
175
|
+
package com.example.hajibootjpa.repository;
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
import com.example.hajibootjpa.domain.Customer;
|
180
|
+
|
181
|
+
import org.springframework.data.domain.Page;
|
182
|
+
|
183
|
+
import org.springframework.data.domain.Pageable;
|
184
|
+
|
185
|
+
import org.springframework.data.jpa.repository.JpaRepository;
|
186
|
+
|
187
|
+
import org.springframework.data.jpa.repository.Query;
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
import java.util.List;
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
public interface CustomerRepository extends JpaRepository<Customer, Integer> {
|
196
|
+
|
197
|
+
@Query("SELECT x FROM Customer x ORDER BY x.firstName, x.lastName")
|
198
|
+
|
199
|
+
Page<Customer> findAllByName(Pageable pageable);
|
200
|
+
|
201
|
+
}
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
```
|
38
206
|
|
39
207
|
### 試したこと
|
40
208
|
|