質問編集履歴

1

コードのミスしている個所に、コメントを付与

2018/02/07 14:38

投稿

yuji38kwmt
yuji38kwmt

スコア437

title CHANGED
File without changes
body CHANGED
@@ -51,7 +51,7 @@
51
51
  public int insertStudent(String studentName) {
52
52
  Map<String,Object> sqlMap = new HashMap<>();
53
53
  sqlMap.put("studentName",studentName);
54
- sqlSession.insert("insertStudent", studentName);
54
+ sqlSession.insert("insertStudent", studentName); //誤り。正しくは`sqlMap`を渡す
55
55
  return (int) sqlMap.get("studentId"); //NullPointerException
56
56
  }
57
57