Я выполняю несколько операторов обновления под тегом <foreach>
. Запросы, кажется, работают нормально при выполнении в MySQL верстаке. Но во время работы приложения Springboot я сталкиваюсь с ошибкой:
Обновление. xml
<update id="saveSeats" parameterType="map" useGeneratedKeys="true">
<foreach collection="seats" item="seat" separator=";">
UPDATE t002_seat_mst SET IS_ASSIGNED=#{seat.isAssigned},TEAM_ID=#{seat.team.teamId} WHERE (SEAT_ID=#{seat.seatId} AND MAP_ID=#{mapId})
</foreach>;
</update>
Журнал ошибок
### Error updating database. Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE t002_seat_mst SET IS_ASSIGNED=1,TEAM_ID=31 WHERE (SEAT_ID=677 AND MAP_ID=' at line 1
### The error may exist in config/SeatsMapper.xml
### The error may involve com.seat.arrangement.dao.mapper.MapMapper.saveSeats-Inline
### The error occurred while setting parameters
### SQL: UPDATE t002_seat_mst SET IS_ASSIGNED=?,TEAM_ID=? WHERE (SEAT_ID=? AND MAP_ID=?) ; UPDATE t002_seat_mst SET IS_ASSIGNED=?,TEAM_ID=? WHERE (SEAT_ID=? AND MAP_ID=?) ; UPDATE t002_seat_mst SET IS_ASSIGNED=?,TEAM_ID=? WHERE (SEAT_ID=? AND MAP_ID=?) ;
### Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE t002_seat_mst SET IS_ASSIGNED=1,TEAM_ID=31 WHERE (SEAT_ID=677 AND MAP_ID=' at line 1
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE t002_seat_mst SET IS_ASSIGNED=1,TEAM_ID=31 WHERE (SEAT_ID=677 AND MAP_ID=' at line 1] with root cause
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE t002_seat_mst SET IS_ASSIGNED=1,TEAM_ID=31 WHERE (SEAT_ID=677 AND MAP_ID=' at line 1