Do you think it is necessary to mark id fields with insertable = false and updatable = false ?
I haven't seem much people doing this before, but today I checked one code that used these properties setted to false for an id field.
Regards
Do you think it is necessary to mark id fields with insertable = false and updatable = false ?
I haven't seem much 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 to provide the value for that otherwise during insert
.
Read the Java docs to get better understanding, there is no other better substitute.