We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
java: 1.8.0_131 hsweb: 3.0.5
因为有一个字段是 progress,前端走的更新 updateById,希望能避免前端传值更新到此字段。 后台有任务单独对这个 progress 单独维护。
progress
尝试过设置 @Column(updatable = false),但这样 createUpdate() 也无法进行更新
@Column(updatable = false)
The text was updated successfully, but these errors were encountered:
方式一: 重写接口方法,实体类设置为null 方式二:监听 EntityPrepareModifyEvent 通过上下文判断是否可以更新某个字段。如果不能,就将after的字段设置为before的字段。
Sorry, something went wrong.
感谢回复,是否考虑增加类似mbp的updateStrategy=NOT_NULL来控制呢
update本身会忽略null值。 目前两种方式其实都是走createUpdate。后续看能否通过上下文传递强制更新。
感谢回复~
zhou-hao
No branches or pull requests
环境
java: 1.8.0_131
hsweb: 3.0.5
问题说明
因为有一个字段是
progress
,前端走的更新 updateById,希望能避免前端传值更新到此字段。后台有任务单独对这个
progress
单独维护。尝试过设置
@Column(updatable = false)
,但这样 createUpdate() 也无法进行更新The text was updated successfully, but these errors were encountered: