Do you think it is necessary to mark id fields with insertable = false and updatable = false?
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.
精彩评论