Skip to content

Cascading orphan delete may not work on versioned entity #3325

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

Closed
csharper2010 opened this issue Jun 19, 2023 · 0 comments · Fixed by #3326
Closed

Cascading orphan delete may not work on versioned entity #3325

csharper2010 opened this issue Jun 19, 2023 · 0 comments · Fixed by #3326

Comments

@csharper2010
Copy link
Contributor

csharper2010 commented Jun 19, 2023

In a certain scenario, the orphan delete of a child entity is not performed:

Parent entity must be versioned.

Way to reproduce

  • new Parent created
  • Child entity is added to Parent
  • Parent is saved (cascaded to child)
  • Child is removed
  • Flush()

Child is then added to the database with NULL as Parent pointer.

Pull request is created.

I would appreciate addition to next 5.4.x release.

csharper2010 added a commit to csharper2010/nhibernate-core that referenced this issue Jun 19, 2023
VisitCollectionsBeforeSave must be called no matter if substitute is already true.
On versioned entities this is always the case.
@fredericDelaporte fredericDelaporte changed the title Cascading orphan delete does not work in corner case on versioned entity Cascading orphan delete may not work on versioned entity Jun 19, 2023
@hazzik hazzik added this to the 5.5 milestone Jul 17, 2023
hazzik added a commit that referenced this issue Jul 18, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
VisitCollectionsBeforeSave must be called no matter if substitute is already true. 
On versioned entities this is always the case.

Fixes #3325

Co-authored-by: Alex Zaytsev <hazzik@gmail.com>
Co-authored-by: Roman Artiukhin <bahusdrive@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants