-
Notifications
You must be signed in to change notification settings - Fork 132
SimpleR2dbcRepository returns error if call save on an unchanged entity #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for report. The mentioned exception is signaled when a We haven't considered that MySQL has slightly different behavior by default. The MySQL docs say:
/cc @schauder @mirromutth I'm not sure whether it would make sense to enable the |
Yes, for R2DBC MySQL, if See https://github.com/mirromutth/r2dbc-mysql/blob/v0.8.0.RELEASE/src/main/java/dev/miku/r2dbc/mysql/constant/Capabilities.java#L29 , it is commented line, so this flag is disabled now. It should be enabled by default if this will affect Spring Data R2DBC behavior. I will change it soon. |
The issue will be handled in the driver hence closing this ticket. |
This commit adds system property jasync.mysql.CLIENT_FOUND_ROWS that when set will create connections with the flag on. CLIENT_FOUND_ROWS tells the mysql server to send back all rows in where clause and not just the ones that were actually updated. See details in: https://dev.mysql.com/doc/refman/8.0/en/information-functions.html https://dev.mysql.com/doc/internals/en/capability-flags.html This makes more sense in some scenarios. For example: spring-projects/spring-data-r2dbc#253 Also renamed SSLRequestMessage to CapabilityRequestMessage to better reflect the data.
This commit adds system property jasync.mysql.CLIENT_FOUND_ROWS that when set will create connections with the flag on. CLIENT_FOUND_ROWS tells the mysql server to send back all rows in where clause and not just the ones that were actually updated. See details in: https://dev.mysql.com/doc/refman/8.0/en/information-functions.html https://dev.mysql.com/doc/internals/en/capability-flags.html This makes more sense in some scenarios. For example: spring-projects/spring-data-r2dbc#253 Other changes: * Rename SSLRequestMessage to CapabilityRequestMessage to better reflect the data. * Set r2dbc to default CLIENT_FOUND_ROWS=true * Add MysqlConnectionFactoryProvider.CLIENT_FOUND_ROWS property to set/unset property. * Add tests to affected rows on UpdateQuerySpec.kt
Spring Boot 2.2.1.RELEASE
Spring Data R2DBC 1.0.0.RELEASE
R2DBC-(Mysql/SPI) 0.8.0.RELEASE
If I call #save on an unchanged entity, then currently, I am getting an error:
Failed to update table [%s]. Row with Id [%s] does not exist.
I am using the r2dbc-mysql library.
If I alter my path to ensure the item is always actually updated, before save gets called, then it succeeds as expected.
As this is a nested entity, it is being saved as a side-effect of the primary entity.
Is this a bug, as it worked previously for me, or do I need to update the code flow to perform a read and check if anything has changed before I call save?
The text was updated successfully, but these errors were encountered: