티스토리 뷰

public int thubmsUpComment(int commentId, int memberNo) {

  Map<String, Integer> params = new HashMap<>();
    params.put("commentId", commentId);
    params.put("memberNo", memberNo);
    System.out.println(params);
  return insertAction.executeAndReturnKey(params).intValue();
}

 

오류 : comment_id 는 null이 될 수 없다 = commentId를 파라미터로 찾지 못한다

 

 

수정: 객체로 넣어준다

public int thubmsUpComment(int commentId, int memberNo) {
  CommentUp commentUp = new CommentUp(commentId, memberNo);
  SqlParameterSource params = new BeanPropertySqlParameterSource(commentUp);
  return insertAction.executeAndReturnKey(params).intValue();
}

 

왜 파라미터를 못받는가

아직 모름

 

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
글 보관함