As part of learning NHibernate, I am writing a simple demo using a Customer - Order - OrderItem hierarchy. I'm using it to learn how to map collection properties. So, a Customer object has an Orders property, which is an IList<Order>. And an Order has an OrderItems property, which is an IList<OrderItem>.
Here is the mapping markup that I am using for the Customer.Orders property:
<!-- Mapped collection -->
<bag name="Orders" table="Orders" cascade="all">
<key column="CustomerID"/>
<one-to-many class="NHibernateDemo1.Order, NHibernateDemo1"/>
</bag>
And here is the mapping markup that I am using for the Order.OrderItems property:
<!-- Mapped collection -->
<bag name="OrderItems" cascade="all">
<key column="OrderID"/>
<one-to-many class="NHibernateDemo1.OrderItem, NHibernateDemo1"/>
</bag>
The cfg object initializes fine. But when I call cfg.BuildSessionFactory(), I get the following error (copied from the log):
"NHibernate.MappingException: An association from the table Customers refers to an unmapped class: IList`1"
I don't understand the cause of the error or how to fix it. Any help would be greatly appreciated. Thanks in advance!
|