I have an application that will give a user an opportunity to update certain values. I want to send just the info on those columns to the user and take updates.
I'd like to persist a hibernate entity created from what they send to me, but not update the columns that the user does not have access to. Likewise, if they request a new entry, I want to use the data they send me and set the unmentioned columns to the databases defaults.
Is there an easy way or best practice to use?
Should I create a second mapping to the table that just doesn't mention those columns?
I think I will mark the property update="false" on the mapping file. I'd love to hear if there is a way to do it per persist, so if I wrote something else that should change those fields, it could do it.
Use updatable=false in Hibernate to avoid updating the column.
Eg:
@Column(name=CRE_TS, updatable=false)
private Date getCreTs(){
return this.creTs;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With