I have a table called Product, and I have a StorageHistory table.
The Product now contains a reference to StorageHistory in its mappings
<set name="StorageHistories" lazy="false">
<key column="ProductId" />
<one-to-many class="StorageHistory" />
</set>
And it works, when I retrieve an object from ORM, I get an empty ISet.
What gives me a headache is how to build an object in the first place. When I do the following:
var product = new Product();
session.Save(product);
the product.StorageHistories property is NULL and I get a NullReferenceException. So, how do I add items to this collection, or should I go to add StorageHistory items directly to the database?
source
share