one table mapping with multiple classes in NHibernate & C#

Last post 05-15-2008 10:34 AM by jainadha. 0 replies.

Sort Posts:

  • one table mapping with multiple classes in NHibernate & C#

    05-15-2008, 10:34 AM
    • Loading...
    • jainadha
    • Joined on 05-07-2008, 10:12 AM
    • Posts 6

    I want to map DBUser table for which I have written a class,  to another table Order. Now DBUser can have multiple orders. So I have made a property in class DBUser:

     private IList<Order> _Orders = new List<Order>();public IList<Order> Orders

    {

    get { return _Orders; }

    set { _Orders = value; }

    }

    and mapping file is therefore

    <?xml version="1.0" encoding="utf-8" ?>

    <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"

    namespace="NHibernateASPSample.Domain"

    assembly="NHibernateASPSample.Domain">

    <class name="DbUser" table="DbUser" lazy="false">

    <id name="IdUser">

    <column name="IdUser" />

    <generator class="native" />

    </id>

     

    <
    component name="PersonalInfo">

    <property name="Address" />

    <property name="Phone" />

    </component>

    <!-- One-to-many mapping: Orders -->

    <bag name="Orders" cascade="all-delete-orphan" lazy="false">

    <key column="IDUser" />

    <one-to-many class="Order" />

    </bag>

    <property name="Login" column="Login" type="String"/>

    <property name="Password" column="Password" type="String"/>

    <property name="UserData" column="UserData" type="String"/>

    </class>

    </hibernate-mapping>

    Problem is : the program gives error when I run "Association references unmapped class: Order"

    What could be the reason.. please help..

Page 1 of 1 (1 items)
Microsoft Communities
Page view counter