Hi all.
Here are mapping files:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
auto-import="true" namespace="ContactBook.Dao.Domain" assembly="ContactBook">
<class name="ContactBook.Dao.Domain.ContactGroup, ContactBook" lazy="false" table="contact_group">
<id name="Id" access="property" column="contact_group_id">
<generator class="native" />
</id>
<property name="Name" access="property" column="name"/>
<property name="Note" access="property" column="note"/>
<set name="Contacts" lazy="true" table="contact" inverse="false">
<key column="contact_group_id"/>
<one-to-many class="ContactBook.Dao.Domain.ContactGroup, Dao"/>
</set>
</class>
</hibernate-mapping>
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
auto-import="true" namespace="ContactBook.Dao.Domain" assembly="ContactBook">
<class name="ContactBook.Dao.Domain.Contact, ContactBook" lazy="false">
<id name="Id" access="property" column="contact_id">
<generator class="native" />
</id>
<property name="FullName" access="property" column="full_name"/>
<property name="Email" access="property" column="email"/>
<property name="Address" access="property" column="address"/>
<property name="Phone" access="property" column="phone"/>
<property name="Fax" access="property" column="fax"/>
<property name="Mobile" access="property" column="mobile"/>
<property name="Note" access="property" column="note"/>
<property name="BirthDay" access="property" column="birthday"/>
<many-to-one access="property" name="Group" column="contact_group_id" cascade="all" lazy="false"/>
</class>
</hibernate-mapping>
When I retrieve the group that contact belongs to, It return null. I can't retrieve the group of a contact. (contact.Group == null)
So, how can i fix it?
Thanks.