sql - Using MyBatis Update with foreach -


i struggling update statement in mybatis. want put multiple strings in 1 row:

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> id = #{id} 

i've tried following alternatives:

open = "'" close = "'" 

or

separator = "','"     

but still getting exceptions this:

org.springframework.jdbc.badsqlgrammarexception:  ### error updating database. cause: java.sql.sqlexception: ora-01747: invalid user.table.column, table.column, or column specification  ### error may involve my.mybatis.prpmapper.saveparamstodb-inline  ### error occurred while setting parameters  ### sql: update my_filters set groups = ? , ? , templates = ? , ? id = ?  ### cause: java.sql.sqlexception: ora-01747: invalid user.table.column, table.column, or column specification ; bad sql grammar []; nested exception java.sql.sqlexception: ora-01747: invalid user.table.column, table.column, or column specification javax.faces.event.abortprocessingexception: org.springframework.jdbc.badsqlgrammarexception:  

try with

open = "'" close = "'" 

and

separator = ","   

and

${item} 

with these settings mybatis not bind variables performs string substitution. careful string substittution vulnerable sql injection. if face more problems please post updated sql query built mystatis


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -