I've fixed the problem!
This was the original mapping:
Code:
<class name="Order" table="orders">
     <id name="id">
         <generator class="native"/>
     </id>
     <property name="date"/>
     <many-to-one name="customer" column="customer_id"/>
     <list name="lineItems" table="line_items">
         <key column="order_id"/>
         <list-index column="line_number"/>
         <composite-element class="LineItem">
             <property name="quantity"/>
             <many-to-one name="product" column="product_id"/>
         </composite-element>
     </list>
 </class>
The problem is that the LineItems are mapped as a List. This doesn't work very well. When you change this to a set, and remove the list-index part, everything works fine:
Code:
<class name="Order" table="orders">
     <id name="id">
         <generator class="native"/>
     </id>
     <property name="date"/>
     <many-to-one name="customer" column="customer_id"/>
     <set name="lineItems" table="line_items">
         <key column="order_id"/>
         <composite-element class="LineItem">
             <property name="quantity"/>
             <many-to-one name="product" column="product_id"/>
         </composite-element>
     </set>
 </class>
And this is how the C# object is coded:
public class Order 
{ 
   public Int64 ID { get; set; } 
   public Int CustomerID { get; set; } 
   public DateTime Timestamp { get; set; } 
   public Iesi.Collections.Generic.ISet<LineItem> LineItems { get; set; } 
} 
public class LineItem 
{ 
   public Int64 ID { get; set; } 
   public Int OrderID { get; set; } 
   public Product OrderdProduct { get; set; } 
} 
public class Product 
{ 
   public Int64 ID { get; set; } 
   public String SerialNumber { get; set; } 
}