views:

24

answers:

1

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

+1  A: 

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.

Adeel Ansari
thanks ........