Consider allowing attributes annotated with CreatedDate to determine "isNew" status for R2DBC Repositories #1587
Labels
status: declined
A suggestion or change that we don't feel we should currently apply
Affects: r2dbc 6, data-commons 3.1
Currently r2dbc "is new state detection" supports:
@Id
properties@Version
propertiesPersistable::isNew
Another possibility is null
@CreatedDate
properties. I personally don't like nullable id properties and a version property doesn't make sense for my current project since there's only 1 user mutating an entity at a time, but the service does mutate entities, which was causingOptimisticLockingFailureException
to be thrown when an old version comes through the API.My solution was to implement
Persistable
, but it might be nice to support null@CreatedDate
properties natively as an alternative"is new state detection".My entities look like this:
I did try the custom
EntityInformation
route, but that proved to be too difficult when compared to the above solution.Or maybe just add documentation with something like this as an example.
The text was updated successfully, but these errors were encountered: