Skip to content
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

Add support for soft deletes #649

Open
eduanb opened this issue Sep 15, 2021 · 2 comments
Open

Add support for soft deletes #649

eduanb opened this issue Sep 15, 2021 · 2 comments
Labels
type: enhancement A general enhancement

Comments

@eduanb
Copy link

eduanb commented Sep 15, 2021

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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 15, 2021
@mp911de
Copy link
Member

mp911de commented Sep 16, 2021

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

@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 16, 2021
@yangwenliang123
Copy link

Zero is used for undeleted and timestamp is used for deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants