WIP - Better fix for inverse collection forgetting changes #2047
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A more general solution for NH-739 that is applied for all collection types mapped as
inverse="true"
, where the current fix is applied only for bags (#1878). This PR is based on #2010, which extends the collection trackers to be aware of the flushed elements. In order to efficiently find the element owner when it is inserted before the full flush due to the id generator requirements, theGetElementOwner
method was added which uses a precalculated data to get the owner. This logic also fixes an issue withICollection.Count
that #2010 has when an element is inserted before a full flush, which means that this PR should be merged with #2010.In addition, this PR obsoletes #1253 as now it is possible to change the parent of a child when the collection is mapped as
inverse="true"
.