I'm using NHibernate 1.2.
I've found some other posts, but haven't been able to resolve my issue from them.
Very simply, I have an
Order class and mapping, which has an
IList<LineItem> Basket property. Here is the Order.hbm.xml for the Basket property:
Code:
<bag name="Basket" fetch="join" cascade="all-delete-orphan">
<key column="OrderUID" />
<one-to-many class="Example.Model.LineItem" />
</bag>
OrderUID on the LineItem table is NOT-NULL=true. My problem is that I receive a cannot insert null into OrderUID. Obviously the OrderUID is not being populated during the Order Save/Update.
I have tried a bunch of things, but to no avail. Can someone help?
Code:
<class name="Example.Model.LineItem" table="LineItem">
<composite-id>
<key-many-to-one name="Order" class="Example.Model.Order" column="OrderUID" />
<key-property name="ProductId" />
</composite-id>
<property name="Quantity" column="Quantity" type="Int32" not-null="true"/>
<property name="UnitPrice" column="UnitPrice" type="Decimal" not-null="true"/>
</class>