采用iBatis查询出实体信息example,处理特殊业务逻辑,当做参数传给第三方接口;
重新创建一个全新实体newExample,用于更新数据;
担心通过iBatis查询出来的example里实体参数某些值会影响到更新业务,采用全新实体newExample,重新设置只需要做更新的值做处理。
导致iBatis缓存信息,覆盖掉newExample的赋值。
Example example = (Example) this.find("from Example where id = '" + paramID + "'").get(0);//存在缓存
Example newExample = new Example();
newExample.setAttri("4");
int num = this.updateBySql("ExampleServiceSql.updateInfo", newExample);//改用example
方案:第三方接口与更新处理采用一个实体:example;