How to do this Unidirectional NHibernate one-to-one mapping?

Posted by JMSA on Stack Overflow See other posts from Stack Overflow or by JMSA
Published on 2010-06-07T16:03:39Z Indexed on 2010/06/18 8:43 UTC
Read the original article Hit count: 476

Filed under:
|

This is a problem of unidirectional one-to-one mapping in NHibernate.

Student.cs

public class Student
{
    public int ID { get; set; }
    public int Roll { get; set; }
    public int RegNo { get; set; }
    public string Name { get; set; }

    public StudentDetail StudentDetail { get; set; }
}

StudentDetail.cs

public class StudentDetail
{
    public int ID { get; set; }

    public string Father { get; set; }
    public string Mother { get; set; }
}

How can I map these classes (how do the hbm mapping files look like) to the following case of one-to-one relationship?

alt text

Please have a look at the classes very carefully.

© Stack Overflow or respective owner

Related posts about nhibernate

Related posts about one-to-one