Closed efenderbosch-atg closed 1 year ago
This looks like a Spring Data specific issue which we cannot deal with at the Spring Framework level. Please create a report for it in the Spring Data project: https://github.com/spring-projects/spring-data-relational
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.