[mybatis 오류] List<?> 다중 update에서 오류 발생
[ 직면한 오류 ]
WARN 68124 --- [nio-9797-exec-5] o.m.jdbc.message.server.ErrorPacket : Error: 1064-42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UPDATE AAAERROR 68124 --- [nio-9797-exec-5] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:
[ 원인 ]
List<VO> list를 update문의 parameterType으로 받고, 연속 업데이트를 하고 싶었다.
그런데 separator, begin 등을 바꿔도... 아무리 봐도 문법이 맞는데 계속 위와 같은 오류가 발생했다.
HeidiSQL에도 잘만 돌아가는 쿼리문인데 오류가 뜬다. 이러면 spring-mybatis쪽에 이상이 있다고 판단이 들었고 열심히 구글링을 했다.
[ 해결 ]
https://okky.kr/questions/450866
이 분과 동일한 상황이었는데
해결방법은 properties파일에 spring.datasource.url이 있을 것이다.
여기 맨 뒤에 [?allowMultiQueries=true]를 붙이면 해결됐다.
spring.datasource.url=jdbc:mariadb://xxx.xxx.xx.xxx:3306/db_name?allowMultiQueries=true