Mybatis 사용하는 쿼리가 들어있는 xml의 오류
Parameter index out of range (4 > number of parameters, which is 3)
이런 에러 메시지가 발생한다.
1) 파라미터가 인덱스 보다 값을 더 많이 가지고 있는 경우
2) '#{name}' 처럼 xml에 ' ' or " " 로 묶은 경우
3) 나같은 경우에서 image 컬럼에 주석 처리에 문제가 있었음
xml의 주석은
-- , /* */ 이 아니라
<!-- --> 로 사용해야함 !!!!!!!!!!!!!!!!!!!!!
에러가 Parameter index out of range .. 정도로 나옴
반나절 삭제...
INSERT INTO LODGING
(
idx ,
name ,
category ,
area ,
phone ,
address ,
homepage,
checktime ,
content,
information,
park ,
xposition ,
yposition,
-- images ( X )
<!-- images --> ( o )
)
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.idx},
#{item.name} ,
#{item.category} ,
#{item.area} ,
#{item.phone} ,
#{item.address} ,
#{item.homepage},
#{item.checktime} ,
#{item.content},
#{item.information},
#{item.park} ,
#{item.xposition} ,
#{item.yposition},
-- #{item.images} ( X )
<!-- #{item.images} --> ( O )
)
</foreach>
</insert>
'Java > Spring' 카테고리의 다른 글
Controller parameter 받는 방법 (0) | 2022.04.09 |
---|---|
ERROR - java.lang.OutOfMemoryError: Java heap space (0) | 2021.09.16 |
ERROR - Ambiguous mapping found. Cannot map ~~ (0) | 2021.07.05 |
java: cannot access javax.inject.Provider class file for javax.inject.Provider not found (0) | 2021.05.03 |
Spring Security CSRF 적용 (0) | 2021.04.22 |