Reputation: 11
Who can help me map this seemingly simple object hierarchy using nHibernate?
[Document]
identity-field
[DocumentHeader]
field1
field2
[Recipients]
The point to note here is that [DocumentHeader] has no identity and is considered a part of the [Document] entity. I think it isn't a component either because it has associations with other reference objects.
Can this hierarchy be mapped with nHibernate as-is? Can [Document] and [DocumentHeader] be mapped to the same table?
I am using the fluent variant for configuration and IAutoMappingOverrides.
Many thanks!
Upvotes: 1
Views: 46
Reputation: 6876
DocumentHeader
is a component in your case. Nothing prevents you from having references or collections inside the component.
Upvotes: 1