Here is my parent class -
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Data" namespace="Data">
<class name="Data.Parent, Datatable="parent">
<id name="field1_key">
<generator class="identity"/>
</id>
<property name="field2"/>
<property name="field3"/>
<set name="child" table="child" generic="true" inverse="true">
<key column="ch_field1_key" />
<one-to-many class="Data.child, Data"/>
</set>
</class>
</hibernate-mapping>
Here is my parent class -
Code:
public class parent
{
virtual public int field1_key { get; set; }
virtual public int field2 { get; set; }
virtual public int field3 { get; set; }
}
Here is my child mapping -
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Data" namespace="Data">
<class name="Data.child, Data" table="child">
<id name="ch_field1_key">
<generator class="native"/>
</id>
<property name="field2"/>
</class>
</hibernate-mapping>
and here is my child class -
Code:
public class child
{
public virtual int ch_field1_key { get; set; }
public virtual int field2 { get; set; }
public virtual parent myParent { get; set; }
}
Thanks