Depends.
If you're talking about for new records you insert into your data store, you could define a @PreInsert method on your entity object and set the fields accordingly with their default values if no values were specified when the object was instantiated.
If you're talking about for existing records, you could define a @PreUpdate method that checks the existence of a value for the specified columns of interest and if no value exists, set it accordingly. With this approach, it would require your code to load each entity from the datastore and run an update on the entity for this naturally.
Typically if I need to do a mass change however like this, I typically do not do it in the program code but rather do it manually using data scripts that are a part of the deployment process of the application.
|