質問編集履歴

4

修正

2018/05/12 12:02

投稿

bear123
bear123

スコア13

test CHANGED
@@ -1 +1 @@
1
- SPRING MVC JPA 1つのテーブルの2カラムから別テーブルへJOINを行うとサーバーで実行時404になる
1
+ SPRING MVC JPA 実行時404になる
test CHANGED
File without changes

3

エラーログ修正

2018/05/12 12:02

投稿

bear123
bear123

スコア13

test CHANGED
File without changes
test CHANGED
@@ -22,14 +22,12 @@
22
22
 
23
23
 
24
24
 
25
- 正常に起動する際とは違うログが出ていました。
25
+ ログが出ていました。
26
26
 
27
27
  ```
28
28
 
29
29
  エラーログ
30
30
 
31
- INFO Dialect - HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
32
-
33
31
  WARN XmlWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [spring/application-config.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
34
32
 
35
33
  ERROR ContextLoader - Context initialization failed
@@ -38,8 +36,6 @@
38
36
 
39
37
 
40
38
 
41
-
42
-
43
39
  Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
44
40
 
45
41
 
@@ -48,8 +44,6 @@
48
44
 
49
45
 
50
46
 
51
- 5 12, 2018 4:36:49 午後 org.apache.catalina.core.StandardContext listenerStart
52
-
53
47
  重大: クラス [org.springframework.web.context.ContextLoaderListener] のリスナインスタンスにコンテキスト初期化イベントを送信中の例外です
54
48
 
55
49
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [spring/application-config.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
@@ -62,20 +56,6 @@
62
56
 
63
57
  Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: model.TblWarehouseStock column: warehouse_cd (should be mapped with insert="false" update="false")
64
58
 
65
- at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:835)
66
-
67
- at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:853)
68
-
69
- at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:875)
70
-
71
- at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:607)
72
-
73
- at org.hibernate.mapping.RootClass.validate(RootClass.java:265)
74
-
75
- at org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:329)
76
-
77
- at
78
-
79
59
 
80
60
 
81
61
 

2

エラーログ追加

2018/05/12 08:03

投稿

bear123
bear123

スコア13

test CHANGED
File without changes
test CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
 
9
- aテーブル[商品id、倉庫id、エージェントid](この倉庫idと、エージェントidをjoinてそれぞれの名称を取得したい)
9
+ aテーブル[商品id、倉庫id、エージェントid](この倉庫idと、エージェントidをbテーブルの取引先idとjoinてそれぞれの名称を取得したい)
10
10
 
11
11
  bテーブル[取引先id、取引先名称]
12
12
 
@@ -22,6 +22,70 @@
22
22
 
23
23
 
24
24
 
25
+ 正常に起動する際とは違うログが出ていました。
26
+
27
+ ```
28
+
29
+ エラーログ
30
+
31
+ INFO Dialect - HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
32
+
33
+ WARN XmlWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [spring/application-config.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
34
+
35
+ ERROR ContextLoader - Context initialization failed
36
+
37
+ org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [spring/application-config.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
38
+
39
+
40
+
41
+
42
+
43
+ Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
44
+
45
+
46
+
47
+ Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: model.TblWarehouseStock column: warehouse_cd (should be mapped with insert="false" update="false")
48
+
49
+
50
+
51
+ 5 12, 2018 4:36:49 午後 org.apache.catalina.core.StandardContext listenerStart
52
+
53
+ 重大: クラス [org.springframework.web.context.ContextLoaderListener] のリスナインスタンスにコンテキスト初期化イベントを送信中の例外です
54
+
55
+ org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [spring/application-config.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
56
+
57
+
58
+
59
+ Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
60
+
61
+
62
+
63
+ Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: model.TblWarehouseStock column: warehouse_cd (should be mapped with insert="false" update="false")
64
+
65
+ at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:835)
66
+
67
+ at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:853)
68
+
69
+ at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:875)
70
+
71
+ at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:607)
72
+
73
+ at org.hibernate.mapping.RootClass.validate(RootClass.java:265)
74
+
75
+ at org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:329)
76
+
77
+ at
78
+
79
+
80
+
81
+
82
+
83
+ ```
84
+
85
+
86
+
87
+
88
+
25
89
  ### 該当のソースコード
26
90
 
27
91
 
@@ -287,349 +351,3 @@
287
351
 
288
352
 
289
353
  SPRING MVC
290
-
291
- ```
292
-
293
- pom.xml
294
-
295
-
296
-
297
- <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
298
-
299
- <modelVersion>4.0.0</modelVersion>
300
-
301
- <groupId>org.springframework.samples.service.service</groupId>
302
-
303
- <version>0.0.1-SNAPSHOT</version>
304
-
305
- <packaging>war</packaging>
306
-
307
-
308
-
309
- <properties>
310
-
311
-
312
-
313
- <!-- Generic properties -->
314
-
315
- <java.version>1.8</java.version>
316
-
317
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
318
-
319
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
320
-
321
-
322
-
323
- <!-- Web -->
324
-
325
- <jsp.version>2.2</jsp.version>
326
-
327
- <jstl.version>1.2</jstl.version>
328
-
329
- <servlet.version>3.1.0</servlet.version>
330
-
331
-
332
-
333
-
334
-
335
- <!-- Spring -->
336
-
337
- <spring-framework.version>5.0.0.RELEASE</spring-framework.version>
338
-
339
-
340
-
341
- <!-- Spring Data JPA -->
342
-
343
- <spring-data-jpa.version>2.0.6.RELEASE</spring-data-jpa.version>
344
-
345
-
346
-
347
- <!-- Hibernate / JPA -->
348
-
349
- <hibernate.version>5.2.10.Final</hibernate.version>
350
-
351
-
352
-
353
- <!-- Hbenrnate validator -->
354
-
355
- <hivernate-validator.version>6.0.2.Final</hivernate-validator.version>
356
-
357
-
358
-
359
- <!-- H2 database -->
360
-
361
- <h2.version>1.4.196</h2.version>
362
-
363
-
364
-
365
- <!-- Logging -->
366
-
367
- <logback.version>1.2.3</logback.version>
368
-
369
- <slf4j.version>1.7.25</slf4j.version>
370
-
371
-
372
-
373
- <!-- Test -->
374
-
375
- <junit.version>4.12</junit.version>
376
-
377
-
378
-
379
- </properties>
380
-
381
-
382
-
383
- <dependencies>
384
-
385
-
386
-
387
- <!-- Spring MVC -->
388
-
389
- <dependency>
390
-
391
- <groupId>org.springframework</groupId>
392
-
393
- <artifactId>spring-webmvc</artifactId>
394
-
395
- <version>${spring-framework.version}</version>
396
-
397
- </dependency>
398
-
399
-
400
-
401
- <!-- Other Web dependencies -->
402
-
403
- <dependency>
404
-
405
- <groupId>javax.servlet</groupId>
406
-
407
- <artifactId>jstl</artifactId>
408
-
409
- <version>${jstl.version}</version>
410
-
411
- </dependency>
412
-
413
- <dependency>
414
-
415
- <groupId>javax.servlet</groupId>
416
-
417
- <artifactId>javax.servlet-api</artifactId>
418
-
419
- <version>${servlet.version}</version>
420
-
421
- <scope>provided</scope>
422
-
423
- </dependency>
424
-
425
- <dependency>
426
-
427
- <groupId>javax.servlet.jsp</groupId>
428
-
429
- <artifactId>jsp-api</artifactId>
430
-
431
- <version>${jsp.version}</version>
432
-
433
- <scope>provided</scope>
434
-
435
- </dependency>
436
-
437
-
438
-
439
- <!-- Spring and Transactions -->
440
-
441
- <dependency>
442
-
443
- <groupId>org.springframework</groupId>
444
-
445
- <artifactId>spring-tx</artifactId>
446
-
447
- <version>${spring-framework.version}</version>
448
-
449
- </dependency>
450
-
451
-
452
-
453
- <!-- Logging with SLF4J & LogBack -->
454
-
455
- <dependency>
456
-
457
- <groupId>org.slf4j</groupId>
458
-
459
- <artifactId>slf4j-api</artifactId>
460
-
461
- <version>${slf4j.version}</version>
462
-
463
- <scope>compile</scope>
464
-
465
- </dependency>
466
-
467
- <dependency>
468
-
469
- <groupId>ch.qos.logback</groupId>
470
-
471
- <artifactId>logback-classic</artifactId>
472
-
473
- <version>${logback.version}</version>
474
-
475
- <scope>runtime</scope>
476
-
477
- </dependency>
478
-
479
-
480
-
481
- <!-- validation -->
482
-
483
- <dependency>
484
-
485
- <groupId>javax.validation</groupId>
486
-
487
- <artifactId>validation-api</artifactId>
488
-
489
- <version>2.0.0.Final</version>
490
-
491
- </dependency>
492
-
493
- <dependency>
494
-
495
- <groupId>org.hibernate</groupId>
496
-
497
- <artifactId>hibernate-validator</artifactId>
498
-
499
- <version>6.0.9.Final</version>
500
-
501
- </dependency>
502
-
503
- <!-- Hibernate -->
504
-
505
- <dependency>
506
-
507
- <groupId>org.hibernate</groupId>
508
-
509
- <artifactId>hibernate-entitymanager</artifactId>
510
-
511
- <version>${hibernate.version}</version>
512
-
513
- </dependency>
514
-
515
-
516
-
517
- <!-- jdbc -->
518
-
519
- <dependency>
520
-
521
- <groupId>org.springframework</groupId>
522
-
523
- <artifactId>spring-jdbc</artifactId>
524
-
525
- <version>5.0.5.RELEASE</version>
526
-
527
- </dependency>
528
-
529
-
530
-
531
- <!-- Spring Data JPA -->
532
-
533
- <dependency>
534
-
535
- <groupId>org.springframework.data</groupId>
536
-
537
- <artifactId>spring-data-jpa</artifactId>
538
-
539
- <version>${spring-data-jpa.version}</version>
540
-
541
- </dependency>
542
-
543
-
544
-
545
- <!--Spring ORM -->
546
-
547
- <dependency>
548
-
549
- <groupId>org.springframework</groupId>
550
-
551
- <artifactId>spring-orm</artifactId>
552
-
553
- <version>${spring-framework.version}</version>
554
-
555
- </dependency>
556
-
557
-
558
-
559
- <!-- h2 database -->
560
-
561
- <dependency>
562
-
563
- <groupId>com.h2database</groupId>
564
-
565
- <artifactId>h2</artifactId>
566
-
567
- <version>${h2.version}</version>
568
-
569
- </dependency>
570
-
571
-
572
-
573
- <!-- Test Artifacts -->
574
-
575
- <dependency>
576
-
577
- <groupId>org.springframework</groupId>
578
-
579
- <artifactId>spring-test</artifactId>
580
-
581
- <version>${spring-framework.version}</version>
582
-
583
- <scope>test</scope>
584
-
585
- </dependency>
586
-
587
- <dependency>
588
-
589
- <groupId>junit</groupId>
590
-
591
- <artifactId>junit</artifactId>
592
-
593
- <version>${junit.version}</version>
594
-
595
- <scope>test</scope>
596
-
597
- </dependency>
598
-
599
-
600
-
601
- <!-- db connection -->
602
-
603
- <dependency>
604
-
605
- <groupId>commons-dbcp</groupId>
606
-
607
- <artifactId>commons-dbcp</artifactId>
608
-
609
- <version>1.4</version>
610
-
611
- </dependency>
612
-
613
-
614
-
615
- <!-- mysql -->
616
-
617
- <dependency>
618
-
619
- <groupId>mysql</groupId>
620
-
621
- <artifactId>mysql-connector-java</artifactId>
622
-
623
- <version>6.0.2</version>
624
-
625
- </dependency>
626
-
627
-
628
-
629
- </dependencies>
630
-
631
- <artifactId>sampleapp</artifactId>
632
-
633
- </project>
634
-
635
- ```

1

諸所

2018/05/12 07:44

投稿

bear123
bear123

スコア13

test CHANGED
File without changes
test CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
 
9
- aテーブル[商品id、倉庫id、代理店id](この倉庫idと、代理店idをjoinにてそれぞれの名称を取得したい)
9
+ aテーブル[商品id、倉庫id、エージェントid](この倉庫idと、エージェントidをjoinにてそれぞれの名称を取得したい)
10
10
 
11
11
  bテーブル[取引先id、取引先名称]
12
12