How to do this 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/07
            16:22 UTC
        
        
        Read the original article
        Hit count: 460
        
nhibernate
|one-to-one
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 two distinct cases of one-to-one relationships?
1st case:

2nd case:

© Stack Overflow or respective owner