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

Fixes cascading orphan delete on versioned entity #3326

Merged
merged 17 commits into from
Jul 18, 2023

Conversation

csharper2010
Copy link
Contributor

@csharper2010 csharper2010 commented Jun 19, 2023

VisitCollectionsBeforeSave must be called no matter if substitute is already true. On versioned entities this is always the case.

Fixes #3325

csharper2010 and others added 2 commits June 19, 2023 12:03
VisitCollectionsBeforeSave must be called no matter if substitute is already true.
On versioned entities this is always the case.
@bahusoid
Copy link
Member

Looks like similar hibernate fix hibernate/hibernate-orm#3513

@fredericDelaporte fredericDelaporte changed the title Fixes #3325 Fixes orphan delete not done in some cases Jun 19, 2023
hazzik
hazzik previously approved these changes Jul 12, 2023
Copy link
Member

@hazzik hazzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've aligned tests to Hibernate and also applied @fredericDelaporte's suggestion

bahusoid
bahusoid previously approved these changes Jul 13, 2023
Copy link
Member

@bahusoid bahusoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hibernate fix also uses optimization with additional isNewlyInstantiated check

default boolean isNewlyInstantiated() {
return getKey() == null && !isDirty();
}

It's wrong and breaks case when unwrapped collection is used for modifications. Adjusted test case to catch this case if someone decides to port this "optimization"

bahusoid
bahusoid previously approved these changes Jul 13, 2023
@hazzik
Copy link
Member

hazzik commented Jul 14, 2023

It's wrong and breaks case when unwrapped collection is used for modifications.

Shall we notify them?

@hazzik hazzik changed the title Fixes orphan delete not done in some cases Fixes cascading orphan delete on versioned entity Jul 14, 2023
@hazzik hazzik enabled auto-merge (squash) July 14, 2023 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cascading orphan delete may not work on versioned entity
4 participants