spring mvc + mybatis
做一个用户信息更新操作,传入一个user对象:
{ userCode : admin, userName : null, userPassword : null, boUser : null, boPassword : null, ncUser : null, userGroup : null, defaultOrg : G0000000, isAdmin : null }
然后用mybatis执行update语句
<update id="updateByUserCode" parameterType="com.shanshan.bo.po.SsFundDimPortaluser">
update SS_FUND_DIM_PORTALUSER
<trim prefix="set" suffixOverrides="," >
<if test="userName != null" >
USER_NAME = #{userName,jdbcType=VARCHAR},
</if>
<if test="userPassword != null" >
USER_PASSWORD = #{userPassword,jdbcType=VARCHAR},
</if>
<if test="boUser != null" >
BO_USER = #{boUser,jdbcType=VARCHAR},
</if>
<if test="boPassword != null" >
BO_PASSWORD = #{boPassword,jdbcType=VARCHAR},
</if>
<if test="ncUser != null" >
NC_USER = #{ncUser,jdbcType=VARCHAR},
</if>
<if test="defaultOrg != null" >
DEFAULT_ORG = #{defaultOrg,jdbcType=VARCHAR},
</if>
<if test="isAdmin != null" >
ISADMIN = #{isAdmin,jdbcType=VARCHAR},
</if>
<if test="userGroup != null" >
USER_GROUP = #{userGroup,jdbcType=VARCHAR},
</if>
</trim>
where USER_CODE = #{userCode,jdbcType=VARCHAR}
</update>
但是报错!
org.springframework.jdbc.UncategorizedSQLException:
### Error updating database. Cause: java.sql.SQLException: [Sybase][JDBC Driver][Sybase IQ]Invalid statement
### The error may involve com.shanshan.bo.mapper.SsFundDimPortaluserMapper.updateByUserCode-Inline
### The error occurred while setting parameters
### SQL: update SS_FUND_DIM_PORTALUSER set DEFAULT_ORG = ? where USER_CODE = ?
### Cause: java.sql.SQLException: [Sybase][JDBC Driver][Sybase IQ]Invalid statement
; uncategorized SQLException for SQL []; SQL state [HY000]; error code [-130]; [Sybase][JDBC Driver][Sybase IQ]Invalid statement; nested exception is java.sql.SQLException: [Sybase][JDBC Driver][Sybase IQ]Invalid statement