I am new to Nhibernate and I am using Nhibernate 2.1.0 RC1. In C# I have the following classes:
public class Application
{
    public virtual int Id { get; set; }
    public virtual Applicant Applicant { get; set; }
}
public class Applicant
{
    public virtual int Id { get; set; }
    public virtual string FirstName { get; set; }
    public virtual string LastName { get; set; }
    public virtual IList<Application> Applications { get; set; } //maybe i should use set to eliminate duplicates
}
And I have the following database schema in SQL Server 2005:
Applications table
{
  ApplicationId int PK IDENTITY NOTNULL
  FK_ApplicantId int FK NOTNULL
}
Applicants table
{
  ApplicantId int PK IDENTITY NOTNULL
  FirstName string NOTNULL
  LastName string NOTNULL
}
And I have the following Nhibernate mapping file:
I need bidirectional mapping :
- 1 applicant can have > 1 application
 - 1 application belongs to 1 applicant
 
I have no idea how to map Application collection to Applicant. Please help. Thanks! Also I am not using Fluent Nhibernate as it doesn't seem to support Nhibernate 2.1.0 RC1 yet.
Updated (this is the working version):
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   assembly="HelloWorld"
                   namespace="HelloWorld">
  <class name="Application" table="Applications">
    <id name="Id" column="ApplicationID" />
    <property name="Reference" />
    <many-to-one name="Applicant" column="ApplicantID" not-null="true"/>
  </class>
  <class name="Applicant" table="Applicants">
    <id name="Id" column="ApplicantID" />
    <property name="FirstName" column="FirstName" />
    <property name="LastName" column="LastName" />
    <set name="Applications" inverse="true"> <!-- good to remove this mapping -->
      <key column="ApplicantID"/>
      <one-to-many class="Application"/>
    </set>
  </class>
</hibernate-mapping>
I would also remove the Application collection from Applicant object to reduce the change of load thousands of applications an applicant lodged. Reason for this is here..