質問編集履歴

1

テーブルの追加

2018/09/12 19:56

投稿

machamp
machamp

スコア7

test CHANGED
File without changes
test CHANGED
@@ -166,103 +166,71 @@
166
166
 
167
167
  private Integer category_id;
168
168
 
169
-
170
-
171
- public Integer getId() {
172
-
173
- return id;
174
-
175
- }
176
-
177
-
178
-
179
- public void setId(Integer id) {
180
-
181
- this.id = id;
182
-
183
- }
184
-
185
-
186
-
187
- public String getName() {
188
-
189
- return name;
190
-
191
- }
192
-
193
-
194
-
195
- public void setName(String name) {
196
-
197
- this.name = name;
198
-
199
- }
200
-
201
-
202
-
203
- public Integer getPrice() {
204
-
205
- return price;
206
-
207
- }
208
-
209
-
210
-
211
- public void setPrice(Integer price) {
212
-
213
- this.price = price;
214
-
215
- }
216
-
217
-
218
-
219
- public String getImage_pass() {
220
-
221
- return image_pass;
222
-
223
- }
224
-
225
-
226
-
227
- public void setImage_pass(String image_pass) {
228
-
229
- this.image_pass = image_pass;
230
-
231
- }
232
-
233
-
234
-
235
- public String getShow_image_pass() {
236
-
237
- return show_image_pass;
238
-
239
- }
240
-
241
-
242
-
243
- public void setShow_image_pass(String show_image_pass) {
244
-
245
- this.show_image_pass = show_image_pass;
246
-
247
- }
248
-
249
-
250
-
251
- public Integer getCategory_id() {
252
-
253
- return category_id;
254
-
255
- }
256
-
257
-
258
-
259
- public void setCategory_id(Integer category_id) {
260
-
261
- this.category_id = category_id;
262
-
263
- }
264
-
265
-
169
+ ```
170
+
171
+
172
+
173
+ ```beans
174
+
175
+ @NamedQueries({
176
+
177
+ @NamedQuery(
178
+
179
+ name = "checkRegisterdEmail",
180
+
181
+ query = "SELECT COUNT(u) FROM User AS u WHERE u.email = :email"
182
+
183
+ ),
184
+
185
+ @NamedQuery(
186
+
187
+ name = "checkLoginCode",
188
+
189
+ query = "SELECT u FROM User AS u WHERE u.email = :email AND u.password = :password"
190
+
191
+ )
192
+
193
+ })
194
+
195
+ @Table(name = "users")
196
+
197
+
198
+
199
+ @Entity
200
+
201
+ public class User {
202
+
203
+ @Id
204
+
205
+ @Column(name = "id")
206
+
207
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
208
+
209
+ private Integer id;
210
+
211
+
212
+
213
+ @Column(name = "name", length = 12, nullable = false)
214
+
215
+ private String name;
216
+
217
+
218
+
219
+ @Column(name = "address", nullable = false)
220
+
221
+ private String address;
222
+
223
+
224
+
225
+ @Column(name = "email", nullable = false, unique = true)
226
+
227
+ private String email;
228
+
229
+
230
+
231
+ @Column(name = "password", nullable = false)
232
+
233
+ private String password;
266
234
 
267
235
  }
268
236
 
@@ -270,156 +238,6 @@
270
238
 
271
239
 
272
240
 
273
- ```beans
274
-
275
- @NamedQueries({
276
-
277
- @NamedQuery(
278
-
279
- name = "checkRegisterdEmail",
280
-
281
- query = "SELECT COUNT(u) FROM User AS u WHERE u.email = :email"
282
-
283
- ),
284
-
285
- @NamedQuery(
286
-
287
- name = "checkLoginCode",
288
-
289
- query = "SELECT u FROM User AS u WHERE u.email = :email AND u.password = :password"
290
-
291
- )
292
-
293
- })
294
-
295
- @Table(name = "users")
296
-
297
-
298
-
299
- @Entity
300
-
301
- public class User {
302
-
303
- @Id
304
-
305
- @Column(name = "id")
306
-
307
- @GeneratedValue(strategy = GenerationType.IDENTITY)
308
-
309
- private Integer id;
310
-
311
-
312
-
313
- @Column(name = "name", length = 12, nullable = false)
314
-
315
- private String name;
316
-
317
-
318
-
319
- @Column(name = "address", nullable = false)
320
-
321
- private String address;
322
-
323
-
324
-
325
- @Column(name = "email", nullable = false, unique = true)
326
-
327
- private String email;
328
-
329
-
330
-
331
- @Column(name = "password", nullable = false)
332
-
333
- private String password;
334
-
335
-
336
-
337
- public Integer getId() {
338
-
339
- return id;
340
-
341
- }
342
-
343
-
344
-
345
- public void setId(Integer id) {
346
-
347
- this.id = id;
348
-
349
- }
350
-
351
-
352
-
353
- public String getName() {
354
-
355
- return name;
356
-
357
- }
358
-
359
-
360
-
361
- public void setName(String name) {
362
-
363
- this.name = name;
364
-
365
- }
366
-
367
-
368
-
369
- public String getAddress() {
370
-
371
- return address;
372
-
373
- }
374
-
375
-
376
-
377
- public void setAddress(String address) {
378
-
379
- this.address = address;
380
-
381
- }
382
-
383
-
384
-
385
- public String getEmail() {
386
-
387
- return email;
388
-
389
- }
390
-
391
-
392
-
393
- public void setEmail(String email) {
394
-
395
- this.email = email;
396
-
397
- }
398
-
399
-
400
-
401
- public String getPassword() {
402
-
403
- return password;
404
-
405
- }
406
-
407
-
408
-
409
- public void setPassword(String password) {
410
-
411
- this.password = password;
412
-
413
- }
414
-
415
-
416
-
417
- }
418
-
419
- ```
420
-
421
-
422
-
423
241
  発生しているエラー :
424
242
 
425
243
 
@@ -434,7 +252,7 @@
434
252
 
435
253
 
436
254
 
437
- 説明 The server encountered an internal error that prevented it from fulfilling this request.
255
+
438
256
 
439
257
 
440
258
 
@@ -577,3 +395,55 @@
577
395
 
578
396
 
579
397
  宜しくお願い致します。
398
+
399
+
400
+
401
+ 追記: テーブルの定義
402
+
403
+
404
+
405
+ itemsテーブル
406
+
407
+ +-----------------+--------------+------+-----+---------+----------------+
408
+
409
+ | Field | Type | Null | Key | Default | Extra |
410
+
411
+ +-----------------+--------------+------+-----+---------+----------------+
412
+
413
+ | id | int(11) | NO | PRI | NULL | auto_increment |
414
+
415
+ | name | varchar(100) | NO | | NULL | |
416
+
417
+ | price | int(11) | NO | | NULL | |
418
+
419
+ | image_pass | varchar(100) | NO | | NULL | |
420
+
421
+ | show_image_pass | varchar(100) | NO | | NULL | |
422
+
423
+ | category_id | int(11) | NO | | NULL | |
424
+
425
+ +-----------------+--------------+------+-----+---------+----------------+
426
+
427
+
428
+
429
+ cartテーブル
430
+
431
+ +-------------+----------+------+-----+---------+----------------+
432
+
433
+ | Field | Type | Null | Key | Default | Extra |
434
+
435
+ +-------------+----------+------+-----+---------+----------------+
436
+
437
+ | id | int(11) | NO | PRI | NULL | auto_increment |
438
+
439
+ | cart_status | int(11) | NO | | 0 | |
440
+
441
+ | item_id | int(11) | NO | | NULL | |
442
+
443
+ | order_at | datetime | YES | | NULL | |
444
+
445
+ | order_num | int(11) | YES | | NULL | |
446
+
447
+ | user_id | int(11) | NO | | NULL | |
448
+
449
+ +-------------+----------+------+-----+---------+----------------+