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

Previous entities are not deleted when replacing OneToMany collection with a new one #3310

Merged
merged 6 commits into from
Feb 9, 2024

Conversation

Ichtil
Copy link
Contributor

@Ichtil Ichtil commented Jan 18, 2024

PR for issue #3309

Ichtil and others added 2 commits January 18, 2024 17:29
- Reuse the existing OmBeanListParent and child
- Simplify the test setup code
- Rename test methods to maybe better reflect what I think is failing

Noting that markAsDirty doesn't specifically have anything to do with this bug but it's more on whether the parent bean is dirty or dirty (markAsDirty is just a way to make the parent bean dirty).
… collection'

The issue fixed here is a timing one where the parent bean is being updated.
The updated parent bean has its internal state reset before the cascade down
to the SaveManyBeans where for this case it needs to identify is the 'vanilla'
collection has set (via setChildren(new ArrayList()).

This fix is a change that for updated beans the dirtyProperties is always obtained
and then use this for the isChangedProperty() check.
@rbygrave rbygrave self-assigned this Feb 9, 2024
@rbygrave rbygrave added this to the 13.26.1 milestone Feb 9, 2024
@rbygrave rbygrave added the bug label Feb 9, 2024
@rbygrave rbygrave merged commit 0abdb15 into ebean-orm:master Feb 9, 2024
1 check passed
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 this pull request may close these issues.

Replacing OneToMany relationship with a new collection doesn't cause delete on old entities
2 participants