Skip to content

NH-3114 - Collection inside Component cannot be mapped to a different table #691

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

Merged
merged 3 commits into from
Sep 19, 2017

Conversation

BhaaLseN
Copy link
Contributor

Fixes https://nhibernate.jira.com/browse/NH-3114 (at least for the case described with explicit column- and table-names specified).

While discussing the issue, we noticed another thing that might happen with such kind of mappings while using implicit names derived from the classes/properties/etc. being used. But since that one appears to be a general issue (also happens with the base XML mappings, not just mapping-by-code) and potentially more complex to fix I decided to only handle the explicit case in here.

Note that I have the habit of doing "Format Document" plus "Remove and Sort usings" when changing/saving files, so PropertyContainerCustomizer.cs took a dip there. I can drop the last commit if you want, though.

the first test verifies mapping-by-code generates a correct mapping, while
the second test inserts an entity with the first component set but currently
also gets the second component collection initialized with the same contents
after retrieving

this fixture is providing explicit column- and table-names to make sure
everything ends up where we expect it.
since PropertyPath is used as dictionary key during mapping/customization,
only considering the local part may lead to customizations being applied to
the wrong members (or being applied multiple times, leaving only the last
invocation each as effective result)

with the parent path included, collection mappings on nested contexts (such
as components) now work properly even when the nested context is repeated
on the same type (such as having multiple properties of the same component
type on a root or subclass)
@fredericDelaporte fredericDelaporte added this to the 5.0 milestone Sep 18, 2017
@fredericDelaporte fredericDelaporte merged commit e8be9d1 into nhibernate:master Sep 19, 2017
@BhaaLseN BhaaLseN deleted the NH-3114 branch September 19, 2017 16:05
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.

3 participants