SSM连接sqlserver获取主键重复

日志:
update M_mouldPlace set item_no=?, warehouse=?, place=?, keeper=?, validate=?, verify=?, accept=?, status=?, remark=?, lastEditNo=?, lastEditDate=? where mouldID = ?
08:34:20.663 [http-bio-8080-exec-3] DEBUG c.c.d.M.editMouldPlace - ==> Parameters: 566(String), 5555(String), 666(String), 333(String), 66633(String), 322(String), 11133(String), 22000(String), 000(String), 777(String), 2017-10-16(String), 10033,10033(String)
08:34:20.695 [http-bio-8080-exec-3] DEBUG c.c.d.M.editMouldPlace - <== Updates: 0
--为什么主键出现了两个10033,10033,导致update失败,删除也是这样
xml文件:

update M_mouldPlace

<!-- item_no = #{item_no,jdbcType=VARCHAR},
warehouse = #{warehouse,jdbcType=VARCHAR},
place = #{place,jdbcType=VARCHAR},
keeper = #{keeper,jdbcType=VARCHAR},
validate = #{validate,jdbcType=VARCHAR},
verify = #{verify,jdbcType=VARCHAR},
accept = #{accept,jdbcType=VARCHAR},
status = #{status,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
lastEditNo = #{lastEditNo,jdbcType=VARCHAR},
lastEditDate = #{lastEditDate,jdbcType=TIMESTAMP} -->
item_no=#{item_no,jdbcType=VARCHAR},
warehouse=#{warehouse,jdbcType=VARCHAR},
place=#{place,jdbcType=VARCHAR},
keeper=#{keeper,jdbcType=VARCHAR},
validate=#{validate,jdbcType=VARCHAR},
verify=#{verify,jdbcType=VARCHAR},
accept=#{accept,jdbcType=VARCHAR},
status=#{status,jdbcType=VARCHAR},
remark=#{remark,jdbcType=VARCHAR},
lastEditNo=#{lastEditNo,jdbcType=VARCHAR},
lastEditDate=#{lastEditDate,jdbcType=TIMESTAMP},

where mouldID = #{mouldID}

xml

2个回答

我怀疑是SSM框架的问题。不是插入数据,是根据主键更新和删除时,值比参数多出一个,导致更新失败。我现在对主键去重规避处理,可以更新删除。但不应该这样处理的。是什么导致了10033,10033(String),而不是10033(String)。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐