在执行插入消息详情字段时,增加了一个为descriptions的属性字段,结果运行程序提示specified twice异常信息。
抛出的具体异常信息如下:Column 'descriptions' specified twice
Mybatis执行配置SQL配置文件中插入语句内容如下:
insert into Link
(createTime,descriptions,hits,isAmous,isRecommend,name,nature,provinceName,
publishTime,refuseReason,status,updateTime,url,smallImage,keywords)
values
(#{createTime,jdbcType=VARCHAR},#{descriptions,jdbcType=VARCHAR},#{hits,jdbcType=VARCHAR},
#{isAmous,jdbcType=VARCHAR},#{isRecommend,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR},
#{nature,jdbcType=VARCHAR},#{provinceName,jdbcType=VARCHAR},#{publishTime,jdbcType=VARCHAR},
#{refuseReason,jdbcType=VARCHAR},#{status,jdbcType=VARCHAR},#{updateTime,jdbcType=VARCHAR},
#{url,jdbcType=VARCHAR},#{smallImage,jdbcType=VARCHAR},#{keywords,jdbcType=VARCHAR})
分析原因
导致上述错误是因为在执行插入操作时,“descriptions”字段在sql中出现了两次。这是由于自己马虎大意,把以前写过的字段忘了,建议大家以后写东西多认真看看再添加字段,防止出现和小编类似的情况,真的尴尬。
解决办法
将多余的字段删除其一问题就可以解决了。