Closed detomarco closed 6 months ago
Try to add @Version property to your entity. I think then it will check based on the version if it's a new entity or not, and it doesn't try to update it.
Is this an expected behaviour/limitation of the library?
It is indeed as we fall back to the identifier to determine whether to insert or update an entity. Check out the documentation on Entity State Detection Strategies.
Hello,
I need to persist an object with UUID generated code side.
but I get this error
In my understanding,
spring-data-r2dbc
uses id to check if the entity is already persisted and it fails when id is set but not found in the database. Is this an expected behaviour/limitation of the library? The only way I found to achieve this is to insert the object manually via DatabaseClient, which is inconvenient in my opinionHere the project to reproduce the issue Spring boot version: 3.2.2