Caused by: org.apache.ibatis.type.TypeException

서현우·2022년 8월 12일
0

트러블슈팅

목록 보기
12/14

Caused by: org.apache.ibatis.type.TypeException
Error setting non null for parameter #5 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: Parameter index out of range (5 > number of parameters, which is 4).

결론적으로 mapper.xml의 update 쿼리문 중간에 주석을 넣어서 발생한 에러였다.
테스트를 위해 비교하려고 주석처리해놨었는데...
주석을 제거하니 정상 동작 했다.
sql작성 할 때 주석이 에러를 발생시킬 수 있다!!

아래는 에러가 발생한 코드.

    <update id="update" parameterType="AccompanyDto">
        UPDATE accompany
--         SET region_code = #{regionCode}, start_at = #{startAt}, end_at = #{endAt}, thumbnail = #{thumbnail},
--             title = #{title}, content = #{content}, member_cnt = #{memberCnt}, hashtag = #{hashtag}, updated_by = #{userId}, updated_at = now()
        SET title = #{title}, content = #{content}
        WHERE id = #{id} AND user_id = #{userId}
    </update>
    ```

profile
안녕하세요!!

0개의 댓글