开发者

Do you think it is necessary to mark id fields with insertable = false and updatable = false?

开发者 https://www.devze.com 2023-01-21 04:36 出处:网络
Do you think it is necessary to mark id fields with insertable = false and updatable = false ? I haven\'t seem much 开发者_Go百科people doing this before, but today I checked one code that used these

Do you think it is necessary to mark id fields with insertable = false and updatable = false ?

I haven't seem much 开发者_Go百科people doing this before, but today I checked one code that used these properties setted to false for an id field.

Regards


No, not at all. It depends whether you really don't want that field to persist. In the mentioned case of an id, I assume it a primary key for that entity. So, I can think of updatable = false for an id, but insertable = false is unlikely. You need to check how its configured otherwise to provide the value for that during insert.

Read the Java docs to get better understanding, there is no other better substitute.

0

精彩评论

暂无评论...
验证码 换一张
取 消