-
Notifications
You must be signed in to change notification settings - Fork 946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.39中dao.insert()方法,没有忽略null字段 #66
Comments
这确实是一个bug,并非使用不当。1.b.37时是正常的 |
麻烦给出示例代码 |
class A { |
仔细想想,插入时忽略null是对的,因为忽略了,数据库如果没有默认值,本身就是null |
确实是这样的,我也觉得有问题是BUG |
而且过滤字段不能解决问题,如果某条件下需要设置该值的话,那就没法实现了。 |
刚刚想到了,这个 bug 很难 fix 哦。 要加很多特殊判断 这是现在 Dao 底层实现机制造成的限制,它应该再聪明点,如果仅仅插入一条,那么就做非空判断 当然,我们也要再观察一下这个 Issue 一段时间,我们可能会对 Dao 的底层实现机制做点调整,当然这个调整是一定不会改变使用的 |
兄弟们,修复一下这个bug吧,等了好久了 (┬_┬) |
有点难搞 |
@happyday517 你数据库里面一定要有个值吗? 如果那样,设个
好了 |
看来这个问题还是不修为好 |
重新考虑一下
让我想想 ... |
看来这个问题由来已久,不知道现在51这个版本有没有解决这个问题了,灰太狼大哥 |
单独一个方法来解决这个问题? 声明这方法是缓慢的 |
按第一个对象来区分是否为null咯 |
已经做好了 |
某些字段我希望由数据库来管理默认值,所以在插入时,这些字段的值为null
但dao.insert()仍然生成了插入这个字段的SQL语句,插入的值为null
导致执行报错
The text was updated successfully, but these errors were encountered: