teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

repositoryクラスの追記

2019/12/06 23:21

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -8,6 +8,7 @@
8
8
  org.springframework.dao.InvalidDataAccessApiUsageException: Unknown entity: com.example.demo.KakeiboDto; nested exception is java.lang.IllegalArgumentException: Unknown entity: com.example.demo.KakeiboDto
9
9
 
10
10
  HTMLファイル
11
+ ```
11
12
  <body>
12
13
  <p class="msg" th:text="${title}"></p>
13
14
  <p th:text="${errmsg}"></p>
@@ -36,8 +37,10 @@
36
37
  <input type="submit" name="登録" />
37
38
  </form>
38
39
  </body>
40
+ ```
39
41
 
40
42
 
43
+ ```
41
44
  コントローラークラス
42
45
  @PostMapping("/insert")
43
46
  public String insert(@ModelAttribute KakeiboForm form,Model model,long id) {
@@ -49,7 +52,17 @@
49
52
  model.addAttribute("msg",dto);
50
53
  return "update";
51
54
  }
55
+ ```
52
56
 
57
+ ```リポジトリ-クラス
58
+ @Repository
59
+ public interface KakeiboRepository extends JpaRepository<KakeiboEntity,Long> {
60
+
61
+ }
62
+ ```
63
+
64
+
65
+ ```
53
66
  Dtoクラス
54
67
  public class KakeiboDto {
55
68
  private long id;
@@ -59,8 +72,10 @@
59
72
  private String syousai;
60
73
  private String bikou;
61
74
         //getter,setter省略
75
+ ```
62
76
 
63
-
77
+ ```
64
78
  Formクラス
65
79
  public class KakeiboForm {
66
-        //Dtoクラスと同じ仕様
80
+        //Dtoクラスと同じ仕様
81
+ ```

1

問題の修正

2019/12/06 23:21

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -1,4 +1,5 @@
1
- 問題:Dtoクラスが怒られておりどう修正すればいかわからない。
1
+ 問題:Dtoクラスが怒られているが、フィールドとgetter,setterしかなくどう変更すればいかわからない。
2
+
2
3
  実現したいこと:フォーム画面の情報(ID(hidden)、日付、項目、金額、詳細、備考)を登録する。
3
4
 
4
5