spring-data-r2dbc
spring-data-r2dbc copied to clipboard
Add support for soft deletes
With Hibernate and Spring Data JPA you can do a soft delete like this:
@SQLDelete(sql = "UPDATE user SET deleted = true WHERE id = ?", check = ResultCheckStyle.COUNT)
@Where(clause = "deleted = false")
class User {
...
}
Now when you do a delete from the repository it will just set deleted =true
and with every select, it adds deleted = false
.
Similar functionality in Spring Data R2DBC would be very useful.
For the time being, we do not support soft deletes as we do not have a consistent design across all store modules how removal or retrieval should be working. For the time being, please solve this issue within your application by e.g. providing a custom repository implementation.
See also spring-projects/spring-data-jpa#676
Zero is used for undeleted and timestamp is used for deleted.