NHibernate unmapped class exception
Posted
by John Prideaux
on Stack Overflow
See other posts from Stack Overflow
or by John Prideaux
Published on 2010-03-23T00:49:41Z
Indexed on
2010/03/23
0:51 UTC
Read the original article
Hit count: 487
nhibernate
|nhibernate-mapping
I am trying to implement a one-to-many relationship using NHibernate 2.1.2 but keep getting "Association references unmapped class" exceptions. I have verified that my hbm.xml files are embedded resource. Here are my classes and mappings. Any ideas?
public class OrderStatus
{
public virtual decimal MainCommit { get; set; }
public virtual decimal CommitNumber { get; set; }
public virtual string InvoiceNumber { get; set; }
public virtual string ShipTo { get; set; }
public virtual string CustomerOrderNumber { get; set; }
public virtual string Station { get; set; }
public virtual DateTime RequestedShipDate { get; set; }
public virtual decimal EstimatedValue { get; set; }
public virtual decimal EstimatedWeight { get; set; }
public virtual string Customer { get; set; }
public virtual DateTime InvoiceDate { get; set; }
public virtual ICollection<Promise> Promises { get; set; }
}
<class name="AladdinDb.Models.OrderStatus, AladdinDb" table="vorder_status">
<id name="CommitNumber" type="decimal" column="commit_no">
<generator class="assigned">
<param name="property">
Plan
</param>
</generator>
</id>
<property name="MainCommit" column="main_commit" type="decimal" />
<property name="InvoiceNumber" column="invoice_no" type="string" />
<property name="ShipTo" column="ship_to" type ="string"/>
<property name="CustomerOrderNumber" column="cust_order_no" type="string" />
<property name="Station" column="station" type="string" />
<property name="RequestedShipDate" column="req_ship_date" type="DateTime" />
<property name="EstimatedValue" column="estimated_value" type="decimal"/>
<property name="EstimatedWeight" column="estimated_weight" type="decimal" />
<property name="Customer" column="customer" type="string" />
<property name="InvoiceDate" column="invoice_date" />
<set name="Promises">
<key column="commit_no"></key>
<one-to-many class="Promise" />
</set>
</class>
public class Promise
{
public virtual decimal CommitNumber { get; set; }
public virtual DateTime PromiseDate { get; set; }
public virtual string WhoAsked { get; set; }
public virtual string WhoGave { get; set; }
public virtual string Iffy { get; set; }
}
<class name="AladdinDb.Models.Promise, AladdinDb" table="promise">
<id name="CommitNumber" type="decimal" column="commit_no">
<generator class="assigned" />
</id>
<property name="PromiseDate" column="promise_date" />
<property name="WhoAsked" column="who_asked" />
<property name="WhoGave" column="who_gave" />
<property name="Iffy" column="iffy" />
</class>
© Stack Overflow or respective owner