int insert(T record);
int insertSelective(T record);
insertSelective
对应的 SQL 语句加入了 NULL 检验,只会插入数据不为 null 的字段,而 insert
会插入所有字段,会插入 null 数据。
也就意味着如果定义了表 default 字段,使用 insert 还是会插入 null 而忽略 default
insertSelective 当字段为 null 时会用 default 自动填充
int insert(T record);
int insertSelective(T record);
insertSelective
对应的 SQL 语句加入了 NULL 检验,只会插入数据不为 null 的字段,而 insert
会插入所有字段,会插入 null 数据。
也就意味着如果定义了表 default 字段,使用 insert 还是会插入 null 而忽略 default
insertSelective 当字段为 null 时会用 default 自动填充
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。