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

SoftDelete entities are hard deleted on orphan removal #2948

Closed
Ichtil opened this issue Jan 27, 2023 · 6 comments · Fixed by #2949
Closed

SoftDelete entities are hard deleted on orphan removal #2948

Ichtil opened this issue Jan 27, 2023 · 6 comments · Fixed by #2949
Assignees
Labels
Milestone

Comments

@Ichtil
Copy link
Contributor

Ichtil commented Jan 27, 2023

Expected behavior

Statefully replacing field that is @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) should result in the old value having the soft delete column updated to true.

Actual behavior

The old value is hard deleted (delete from)

Steps to reproduce

Please see attached unit test. The unit test repository is running ebean version 13.6.5 (for newer versions there are some breaking changes), but this bug is happening in our application on the version 13.11.1.

Ichtil added a commit to Ichtil/ebean that referenced this issue Jan 27, 2023
@Ichtil
Copy link
Contributor Author

Ichtil commented Jan 27, 2023

#2949

@Ichtil
Copy link
Contributor Author

Ichtil commented Jan 27, 2023

We have had some issues with soft delete before (#2727 and #2750), but they should be fixed in the version 13.6.5, so this looks like a different issue.

@Ichtil
Copy link
Contributor Author

Ichtil commented Jan 27, 2023

Ok, on second look, I had an old forked version of the repository, sorry for the confusion. I cannot get maven to import the project to the newest version. I'll look at it later.

@Ichtil
Copy link
Contributor Author

Ichtil commented Jan 30, 2023

To clear up the confusion - this bug happens on version 13.11.2, the current repo version of 13.11.3-SNAPSHOT couldn't be imported by maven. Could you please have a look at the reported bug?

@Ichtil
Copy link
Contributor Author

Ichtil commented Feb 1, 2023

This could be related to #2952

@rbygrave
Copy link
Member

rbygrave commented Feb 2, 2023

So in version 11.22.9 Issue #1505 added the code ...de9823b#diff-b252eeaf218f406dfa45c3497ea358735b864214080d3ff07bccc72bd68f2cccR906

... and that true flag there on that delete() method means delete permanent. Turning that to false makes it a "normal delete" which is then changed to a soft delete if the entity in question has soft delete support.

That is, we have had this bug since 11.22.9 when that code was introduce rather than this being a regression.

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

Successfully merging a pull request may close this issue.

2 participants