mybatis date类型 设置null


利用updateByPrimaryKeySelective方法,是无法实现清空操作,因为在XML文件中有NULL判断。

方法1 :

 bean.setValue(null);

Mapper.updateByPrimaryKeyWithBLOBs(bean);

可以使用 updateByPrimaryKeyWithBLOBs方法来实现,弊端就是会更新记录的全部字段!!

方法2:

自己写XML,设置成NULL.