All of my datamodels have field DateAdded. When the user (through MVC Web API) sends a request to save a model, the serverside populates this field with a DateTime object, and then proceeds to save the object via hibernate.
Now consider the case of updating. Even if the user modifies the DateAdded field manually, it should not change the value in the database. Is there a way that I can specify for this field to NOT be updated, regardless of what the user provides? If the field is not populated by the user, the datetime field becomes null, which is also no good.
Turns out there’s a property for this you can set in the hbm file!
Simply set update=”false” on all properties that you don’t want to be updateable. Sorry for not doing more research before wasting precious SO resources.