title: Mapping multiple Values to a Value Object in NHibernate
body: <p>i'm fairly new to NHibernate and although I'm finding tons of infos on NHibernate mapping on the web, I am too silly to find this piece of information.</p>
  
  <p>So the problem is, i've got the following Model:</p>
  
  <p><img src="https://i.stack.imgur.com/DihaU.jpg" alt="Datamodel"></p>
  
  <p>this is how I'd like it to look. One clean person that has two Address Properties. </p>
  
  <p>In the database I'd like to persist this in one table.
  So the Person row would have a ShippingStreetname and a Streetname Column, the one mapped to ShippingAddress.Streetname and the other to Address.StreetName</p>
  
  <p>I found an <a href="http://nhforge.org/blogs/nhibernate/archive/2008/09/06/a-fluent-interface-to-nhibernate-part-2-value-objects.aspx" rel="nofollow noreferrer">article on fluent interfaces</a>, but still haven't figured out how to do this through the XML Configuration.</p>
  
  <p>Thanks in advance!</p>
  
  <p>Update: I found the solution to this by myself. This can be done through the  node and works rather straightforward.</p>
  
  <p>To achieve the mapping of Address and ShippingAddress I just had to add the following to the </p>
  
  <pre><code>&lt;component name="Address" class="Address"&gt;
    &lt;property name="Streetname"&gt;&lt;/property&gt;
    &lt;property name="Zip"&gt;&lt;/property&gt;
    &lt;property name="City"&gt;&lt;/property&gt;
    &lt;property name="Country"&gt;&lt;/property&gt;
  &lt;/component&gt;
  
  &lt;component name="ShippingAddress" class="Address"&gt;
    &lt;property name="Streetname" column="ShippingStreetname" /&gt;
    &lt;property name="Zip" column="ShippingZip" /&gt;
    &lt;property name="City" column="ShippingCity" /&gt;
    &lt;property name="Country" column="ShippingCountry" /&gt;
  &lt;/component&gt;
  </code></pre>