user2416848
user2416848

Reputation: 11

Simple mapping of inner object without identity

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

Answers (1)

cremor
cremor

Reputation: 6876

DocumentHeader is a component in your case. Nothing prevents you from having references or collections inside the component.

Upvotes: 1

Related Questions