Was to see how/if child classes were saved. After some digging I modified my Comonent and was able to get a little further along
Database Table:
Component
Id
AddressId
PaymentId
Class Definition:
Component
Id
AddressInformation
PaymentInformation
Mapping File:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Orders.Composite, Orders" table="tmpCompositeDebug" lazy="false">
<id name="Id" column="Id" unsaved-value="0">
<generator class="native"/>
</id>
<many-to-one name="AddressInformation" class="Orders.Address, Orders" column="AddressId" cascade="all" />
</class>
</hibernate-mapping>
UsageCode snippet from a test stub:
Code:
Composite loaded = _CurrentSession.Load<Component>(1002);
Assert.IsNotNull(loaded); //at this point everything is loaded ok
string address1 = DateTime.Now.Ticks.ToString();
Address newAddress = new Address();
newAddress.AddressLine1 = "unit testAddresses";
newAddress.City = address1;
newAddress.State = "ZZ";
newAddress.PostCode = "99999";
loaded.AddressInformation = newAddress;
Assert.AreEqual(loaded.AddressInformation.City, address1);
_CurrentSession.Update(loaded);
When I call the update method I would like for my Address table to be updated. Is there a way to do this, or do I need to call Save/Update for all child classes?
Thanks
Joe