質問編集履歴

3

追加情報

2021/01/14 05:58

投稿

K_3578
K_3578

スコア1282

test CHANGED
File without changes
test CHANGED
@@ -32,6 +32,196 @@
32
32
 
33
33
  javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
34
34
 
35
+
36
+
37
+ 原因
38
+
39
+
40
+
41
+ org.hibernate.exception.SQLGrammarException: could not extract ResultSet
42
+
43
+
44
+
45
+ 原因
46
+
47
+
48
+
49
+ com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as task5_1_, trucks0_.task_type as task_typ6_1_, trucks0_.truck_code as truck_co' at line 1
50
+
51
+ sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
52
+
53
+
54
+
55
+ ```
56
+
57
+
58
+
59
+ ### 該当のソースコード
60
+
61
+
62
+
63
+ ```ここに言語名を入力
64
+
65
+ package models;
66
+
67
+
68
+
69
+ import javax.persistence.Column;
70
+
71
+ import javax.persistence.Entity;
72
+
73
+ import javax.persistence.GeneratedValue;
74
+
75
+ import javax.persistence.GenerationType;
76
+
77
+ import javax.persistence.Id;
78
+
79
+ import javax.persistence.NamedQueries;
80
+
81
+ import javax.persistence.NamedQuery;
82
+
83
+ import javax.persistence.Table;
84
+
85
+
86
+
87
+ @Table(name = "trucks")
88
+
89
+ @NamedQueries({
90
+
91
+ @NamedQuery(
92
+
93
+ name = "getAllTrucks",
94
+
95
+ query = "SELECT t FROM Trucks AS t ORDER BY t.id DESC"
96
+
97
+ ),
98
+
99
+ @NamedQuery(
100
+
101
+ name = "getTrucksCount",
102
+
103
+ query = "SELECT COUNT(t) FROM Trucks AS t"
104
+
105
+ ),
106
+
107
+ })
108
+
109
+ @Entity
110
+
111
+ public class Vehicles{
112
+
113
+ @Id
114
+
115
+ @Column(name = "id")
116
+
117
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
118
+
119
+ private Integer id;
120
+
121
+
122
+
123
+ @Column(name = "task_date", nullable = false)
124
+
125
+ private java.sql.Date task_date;
126
+
127
+
128
+
129
+ @Column(name = "task time", nullable = false)
130
+
131
+ private java.sql.Time task_time;
132
+
133
+
134
+
135
+ @Column(name = "task_type", nullable = false)
136
+
137
+ private String task_type;
138
+
139
+
140
+
141
+ @Column(name = "office_name", nullable = false)
142
+
143
+ private String office_name;
144
+
145
+
146
+
147
+ @Column(name = "vehicle_code", nullable = false)
148
+
149
+ private String vehicle_code;
150
+
151
+
152
+
153
+ @Column(name = "stack_area", nullable = false)
154
+
155
+ private String stack_area;
156
+
157
+
158
+
159
+ @Column(name = "wholesale_area", nullable = false)
160
+
161
+ private String wholesale_area;
162
+
163
+
164
+
165
+ @Column(name = "vehicle_type", nullable = false)
166
+
167
+ private String vehicle_type;
168
+
169
+ Trucksテーブル
170
+
171
+ *************************** 1. row ***************************
172
+
173
+ Table: trucks
174
+
175
+ Create Table: CREATE TABLE `trucks` (
176
+
177
+ `id` int(11) NOT NULL AUTO_INCREMENT,
178
+
179
+ `office_name` varchar(10) DEFAULT NULL,
180
+
181
+ `truck_code` varchar(15) DEFAULT NULL,
182
+
183
+ `truck_type` varchar(10) DEFAULT NULL,
184
+
185
+ `task_date` date DEFAULT NULL,
186
+
187
+ `stack_area` varchar(10) DEFAULT NULL,
188
+
189
+ `wholesale_area` varchar(10) DEFAULT NULL,
190
+
191
+ `task_time` time DEFAULT NULL,
192
+
193
+ PRIMARY KEY (`id`)
194
+
195
+ ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8
196
+
197
+ ```
198
+
199
+
200
+
201
+ ### 新たなエラー
202
+
203
+ ```
204
+
205
+ HTTPステータス 500 - org.hibernate.exception.SQLGrammarException: could not extract ResultSet
206
+
207
+ type 例外レポート
208
+
209
+
210
+
211
+ メッセージ org.hibernate.exception.SQLGrammarException: could not extract ResultSet
212
+
213
+
214
+
215
+ 説明 The server encountered an internal error that prevented it from fulfilling this request.
216
+
217
+
218
+
219
+ 例外
220
+
221
+
222
+
223
+ javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
224
+
35
225
  org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:149)
36
226
 
37
227
  org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:157)
@@ -116,309 +306,83 @@
116
306
 
117
307
 
118
308
 
119
- com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as task5_1_, trucks0_.task_type as task_typ6_1_, trucks0_.truck_code as truck_co' at line 1
309
+ com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'trucks0_.task_type' in 'field list'
120
310
 
121
311
  sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
122
312
 
123
-
124
-
125
- ```
126
-
127
-
128
-
129
- ### 該当のソースコード
130
-
131
-
132
-
133
- ```ここに言語名を入力
134
-
135
- package models;
136
-
137
-
138
-
139
- import javax.persistence.Column;
140
-
141
- import javax.persistence.Entity;
142
-
143
- import javax.persistence.GeneratedValue;
144
-
145
- import javax.persistence.GenerationType;
146
-
147
- import javax.persistence.Id;
148
-
149
- import javax.persistence.NamedQueries;
150
-
151
- import javax.persistence.NamedQuery;
152
-
153
- import javax.persistence.Table;
154
-
155
-
156
-
157
- @Table(name = "trucks")
158
-
159
- @NamedQueries({
160
-
161
- @NamedQuery(
162
-
163
- name = "getAllTrucks",
164
-
165
- query = "SELECT t FROM Trucks AS t ORDER BY t.id DESC"
166
-
167
- ),
168
-
169
- @NamedQuery(
170
-
171
- name = "getTrucksCount",
172
-
173
- query = "SELECT COUNT(t) FROM Trucks AS t"
174
-
175
- ),
176
-
177
- })
178
-
179
- @Entity
180
-
181
- public class Vehicles{
182
-
183
- @Id
184
-
185
- @Column(name = "id")
186
-
187
- @GeneratedValue(strategy = GenerationType.IDENTITY)
188
-
189
- private Integer id;
190
-
191
-
192
-
193
- @Column(name = "task_date", nullable = false)
194
-
195
- private java.sql.Date task_date;
196
-
197
-
198
-
199
- @Column(name = "task time", nullable = false)
200
-
201
- private java.sql.Time task_time;
202
-
203
-
204
-
205
- @Column(name = "task_type", nullable = false)
206
-
207
- private String task_type;
208
-
209
-
210
-
211
- @Column(name = "office_name", nullable = false)
212
-
213
- private String office_name;
214
-
215
-
216
-
217
- @Column(name = "vehicle_code", nullable = false)
218
-
219
- private String vehicle_code;
220
-
221
-
222
-
223
- @Column(name = "stack_area", nullable = false)
224
-
225
- private String stack_area;
226
-
227
-
228
-
229
- @Column(name = "wholesale_area", nullable = false)
230
-
231
- private String wholesale_area;
232
-
233
-
234
-
235
- @Column(name = "vehicle_type", nullable = false)
236
-
237
- private String vehicle_type;
238
-
239
-
240
-
241
-
242
-
243
- public Integer getId() {
244
-
245
- return id;
246
-
247
- }
248
-
249
-
250
-
251
- public void setId(Integer id) {
252
-
253
- this.id = id;
254
-
255
- }
256
-
257
-
258
-
259
- public java.sql.Date getTask_date() {
260
-
261
- return task_date;
262
-
263
- }
264
-
265
-
266
-
267
- public void setTask_date(java.sql.Date task_date) {
268
-
269
- this.task_date = task_date;
270
-
271
- }
272
-
273
-
274
-
275
- public java.sql.Time getTask_time() {
276
-
277
- return task_time;
278
-
279
- }
280
-
281
-
282
-
283
- public void setTask_time(java.sql.Time task_time) {
284
-
285
- this.task_time = task_time;
286
-
287
- }
288
-
289
-
290
-
291
- public String getOffice_name() {
292
-
293
- return office_name;
294
-
295
- }
296
-
297
-
298
-
299
- public void setOffice_name(String office_name) {
300
-
301
- this.office_name = office_name;
302
-
303
- }
304
-
305
-
306
-
307
-
308
-
309
- public void setTask_type(String task_type){
310
-
311
- this.task_type = task_type;
312
-
313
- }
314
-
315
-
316
-
317
-
318
-
319
- public String getVehicle_code() {
320
-
321
- return vehicle_code;
322
-
323
- }
324
-
325
-
326
-
327
- public void setVehicle_code(String vehicle_code) {
328
-
329
- this.vehicle_code = vehicle_code;
330
-
331
- }
332
-
333
-
334
-
335
- public String getStack_area() {
336
-
337
- return stack_area;
338
-
339
- }
340
-
341
-
342
-
343
- public void setStack_area(String stack_area) {
344
-
345
- this.stack_area = stack_area;
346
-
347
- }
348
-
349
-
350
-
351
- public String getWholesale_area() {
352
-
353
- return wholesale_area;
354
-
355
- }
356
-
357
-
358
-
359
- public void setWholesale_area(String wholesale_area) {
360
-
361
- this.wholesale_area = wholesale_area;
362
-
363
- }
364
-
365
-
366
-
367
- public String getVehicle_type() {
368
-
369
- return vehicle_type;
370
-
371
- }
372
-
373
-
374
-
375
- public void setVehicle_type(String vehicle_type) {
376
-
377
- this.vehicle_type = vehicle_type;
378
-
379
- }
380
-
381
-
382
-
383
- }
384
-
385
-
386
-
387
- Trucksテーブル
388
-
389
- *************************** 1. row ***************************
390
-
391
- Table: trucks
392
-
393
- Create Table: CREATE TABLE `trucks` (
394
-
395
- `id` int(11) NOT NULL AUTO_INCREMENT,
396
-
397
- `office_name` varchar(10) DEFAULT NULL,
398
-
399
- `truck_code` varchar(15) DEFAULT NULL,
400
-
401
- `truck_type` varchar(10) DEFAULT NULL,
402
-
403
- `task_date` date DEFAULT NULL,
404
-
405
- `stack_area` varchar(10) DEFAULT NULL,
406
-
407
- `wholesale_area` varchar(10) DEFAULT NULL,
408
-
409
- `task_time` time DEFAULT NULL,
410
-
411
- PRIMARY KEY (`id`)
412
-
413
- ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8
414
-
415
- ```
416
-
417
-
418
-
419
- ### 試したこと
420
-
421
-
313
+ sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
314
+
315
+ sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
316
+
317
+ java.lang.reflect.Constructor.newInstance(Constructor.java:423)
318
+
319
+ com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
320
+
321
+ com.mysql.jdbc.Util.getInstance(Util.java:408)
322
+
323
+ com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944)
324
+
325
+ com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973)
326
+
327
+ com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)
328
+
329
+ com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
330
+
331
+ com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
332
+
333
+ com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2484)
334
+
335
+ com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858)
336
+
337
+ com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1966)
338
+
339
+ org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:60)
340
+
341
+ org.hibernate.loader.Loader.getResultSet(Loader.java:2168)
342
+
343
+ org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1931)
344
+
345
+ org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1893)
346
+
347
+ org.hibernate.loader.Loader.doQuery(Loader.java:938)
348
+
349
+ org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:341)
350
+
351
+ org.hibernate.loader.Loader.doList(Loader.java:2692)
352
+
353
+ org.hibernate.loader.Loader.doList(Loader.java:2675)
354
+
355
+ org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2507)
356
+
357
+ org.hibernate.loader.Loader.list(Loader.java:2502)
358
+
359
+ org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:502)
360
+
361
+ org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:392)
362
+
363
+ org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)
364
+
365
+ org.hibernate.internal.SessionImpl.list(SessionImpl.java:1490)
366
+
367
+ org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1445)
368
+
369
+ org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1414)
370
+
371
+ org.hibernate.query.Query.getResultList(Query.java:146)
372
+
373
+ controllers.dispatch.DispatchIndexServlet.doGet(DispatchIndexServlet.java:45)
374
+
375
+ javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
376
+
377
+ javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
378
+
379
+ org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
380
+
381
+ filters.LoginFilter.doFilter(LoginFilter.java:72)
382
+
383
+ filters.EncodingFilter.doFilter(EncodingFilter.java:38)
384
+
385
+ ```
422
386
 
423
387
 
424
388
 

2

情報の追加

2021/01/14 05:58

投稿

K_3578
K_3578

スコア1282

test CHANGED
File without changes
test CHANGED
@@ -120,77 +120,7 @@
120
120
 
121
121
  sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
122
122
 
123
- sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
123
+
124
-
125
- sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
126
-
127
- java.lang.reflect.Constructor.newInstance(Constructor.java:423)
128
-
129
- com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
130
-
131
- com.mysql.jdbc.Util.getInstance(Util.java:408)
132
-
133
- com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944)
134
-
135
- com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973)
136
-
137
- com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)
138
-
139
- com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
140
-
141
- com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
142
-
143
- com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2484)
144
-
145
- com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858)
146
-
147
- com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1966)
148
-
149
- org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:60)
150
-
151
- org.hibernate.loader.Loader.getResultSet(Loader.java:2168)
152
-
153
- org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1931)
154
-
155
- org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1893)
156
-
157
- org.hibernate.loader.Loader.doQuery(Loader.java:938)
158
-
159
- org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:341)
160
-
161
- org.hibernate.loader.Loader.doList(Loader.java:2692)
162
-
163
- org.hibernate.loader.Loader.doList(Loader.java:2675)
164
-
165
- org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2507)
166
-
167
- org.hibernate.loader.Loader.list(Loader.java:2502)
168
-
169
- org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:502)
170
-
171
- org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:392)
172
-
173
- org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)
174
-
175
- org.hibernate.internal.SessionImpl.list(SessionImpl.java:1490)
176
-
177
- org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1445)
178
-
179
- org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1414)
180
-
181
- org.hibernate.query.Query.getResultList(Query.java:146)
182
-
183
- controllers.dispatch.DispatchIndexServlet.doGet(DispatchIndexServlet.java:45)
184
-
185
- javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
186
-
187
- javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
188
-
189
- org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
190
-
191
- filters.LoginFilter.doFilter(LoginFilter.java:72)
192
-
193
- filters.EncodingFilter.doFilter(EncodingFilter.java:38)
194
124
 
195
125
  ```
196
126
 
@@ -452,6 +382,36 @@
452
382
 
453
383
  }
454
384
 
385
+
386
+
387
+ Trucksテーブル
388
+
389
+ *************************** 1. row ***************************
390
+
391
+ Table: trucks
392
+
393
+ Create Table: CREATE TABLE `trucks` (
394
+
395
+ `id` int(11) NOT NULL AUTO_INCREMENT,
396
+
397
+ `office_name` varchar(10) DEFAULT NULL,
398
+
399
+ `truck_code` varchar(15) DEFAULT NULL,
400
+
401
+ `truck_type` varchar(10) DEFAULT NULL,
402
+
403
+ `task_date` date DEFAULT NULL,
404
+
405
+ `stack_area` varchar(10) DEFAULT NULL,
406
+
407
+ `wholesale_area` varchar(10) DEFAULT NULL,
408
+
409
+ `task_time` time DEFAULT NULL,
410
+
411
+ PRIMARY KEY (`id`)
412
+
413
+ ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8
414
+
455
415
  ```
456
416
 
457
417
 

1

文の修正

2021/01/14 05:37

投稿

K_3578
K_3578

スコア1282

test CHANGED
File without changes
test CHANGED
@@ -248,7 +248,7 @@
248
248
 
249
249
  @Entity
250
250
 
251
- public class Trucks{
251
+ public class Vehicles{
252
252
 
253
253
  @Id
254
254
 
@@ -284,9 +284,9 @@
284
284
 
285
285
 
286
286
 
287
- @Column(name = "truck_code", nullable = false)
287
+ @Column(name = "vehicle_code", nullable = false)
288
-
288
+
289
- private String truck_code;
289
+ private String vehicle_code;
290
290
 
291
291
 
292
292
 
@@ -302,9 +302,9 @@
302
302
 
303
303
 
304
304
 
305
- @Column(name = "truck_type", nullable = false)
305
+ @Column(name = "vehicle_type", nullable = false)
306
-
306
+
307
- private String truck_type;
307
+ private String vehicle_type;
308
308
 
309
309
 
310
310
 
@@ -386,17 +386,17 @@
386
386
 
387
387
 
388
388
 
389
- public String getTruck_code() {
389
+ public String getVehicle_code() {
390
-
390
+
391
- return truck_code;
391
+ return vehicle_code;
392
-
392
+
393
- }
393
+ }
394
-
395
-
396
-
394
+
395
+
396
+
397
- public void setTruck_code(String truck_code) {
397
+ public void setVehicle_code(String vehicle_code) {
398
-
398
+
399
- this.truck_code = truck_code;
399
+ this.vehicle_code = vehicle_code;
400
400
 
401
401
  }
402
402
 
@@ -434,17 +434,17 @@
434
434
 
435
435
 
436
436
 
437
- public String getTruck_type() {
437
+ public String getVehicle_type() {
438
-
438
+
439
- return truck_type;
439
+ return vehicle_type;
440
-
440
+
441
- }
441
+ }
442
-
443
-
444
-
442
+
443
+
444
+
445
- public void setTruck_type(String truck_type) {
445
+ public void setVehicle_type(String vehicle_type) {
446
-
446
+
447
- this.truck_type = truck_type;
447
+ this.vehicle_type = vehicle_type;
448
448
 
449
449
  }
450
450