I am trying to save a record which has a many-to-one property mapping. I attempt to assign a newly created parent object here (or use an existing, but that works fine) but I get an error when it tries to add the ID of the parent object to the child's table. Saying it cannot add NULL to the table, which is true, but I thought nHibernate was clever enough to save the parent object first, even if I am adding the child.
Mappings:
Child:
<many-to-one name="parent" class="ParentClass" column="parentID" cascade="all"/>
Parent:
<bag name="DataList" table="ChildTable" lazy="false" inverse="true" cascade="all-delete-orphan">
<key column="parentID" />
<one-to-many class="ChildClass" />
</bag>
Basically, Is this something nHibernate can do?