【发布时间】:2015-06-15 08:15:16
【问题描述】:
我正在为 MyBatis 中的更新语句而苦苦挣扎。我想将多个字符串放在一行中:
UPDATE MY_FILTERS
SET
GROUPS =
<foreach item="item" collection="selectedGroups" open="" separator="," close="">
#{item}
</foreach>,
TEMPLATES =
<foreach item="item" collection="selectedTemplates" open="" separator="," close="">
#{item}
</foreach>
where ID = #{id}
我尝试了以下替代方案:
open = "'" close = "'"
或
separator = "','"
但仍然出现这样的异常:
org.springframework.jdbc.BadSqlGrammarException:
### Error updating database. Cause: java.sql.SQLException: ORA-01747: invalid user.table.column, table.column, or column specification
### The error may involve my.mybatis.PRPMapper.saveParamsToDB-Inline
### The error occurred while setting parameters
### SQL: UPDATE MY_FILTERS SET GROUPS = ? , ? , TEMPLATES = ? , ? where ID = ?
### Cause: java.sql.SQLException: ORA-01747: invalid user.table.column, table.column, or column specification ; bad SQL grammar []; nested exception is java.sql.SQLException: ORA-01747: invalid user.table.column, table.column, or column specification javax.faces.event.AbortProcessingException: org.springframework.jdbc.BadSqlGrammarException:
【问题讨论】: