You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
org.springframework.dao.TransientDataAccessResourceException: Failed to update table [cars]; Row with Id [648e8774-0a5a-49b9-9c93-d435403d0050] does not exist
at org.springframework.data.r2dbc.core.R2dbcEntityTemplate.lambda$doUpdate$12(R2dbcEntityTemplate.java:640)
at reactor.core.publisher.FluxHandle$HandleSubscriber.onNext(FluxHandle.java:113)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79)
at reactor.core.publisher.MonoUsingWhen$MonoUsingWhenSubscriber.deferredComplete(MonoUsingWhen.java:268)
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 opinion
Here the project to reproduce the issue
Spring boot version: 3.2.2
The text was updated successfully, but these errors were encountered:
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 opinion
Here the project to reproduce the issue
Spring boot version: 3.2.2
The text was updated successfully, but these errors were encountered: