-
Notifications
You must be signed in to change notification settings - Fork 690
Description
mxandeco opened DATACMNS-1737 and commented
JPA offers an updatable/insertable property on the @Column
annotation to allow a property to be read only on the scope of that statement, spring-data core annotation does not offer that feature. but offer a ReadOnlyProperty that works almost in the same way.
The main different here is that I can't ignore only update statement if I want to, it can be situations when a read only behavior is desired only for updates and not for inserts, looks like would be more natural to include that filter on the @ReadOnlyProperty
annotation instead of column?
eg.
@ReadOnlyProperty(updatable=true)
private Instant createdAt;
That's a realm example I have now, all our audit logic lives in the db, and is set as default or trigger values. but during some old data sync, we need to also set this value manually, what is then ignored by the db trigger, I am using r2dbc at the moment, and can't see a way to implement this with core mapping annotation without having to write code to deal with it
Affects: 2.3 GA (Neumann)