views:

184

answers:

0

I have the following two tables in a legacy database

Group 
--------- 
Id (PK) 
Code (char(4)) 
Year (int) 
Name nvarchar(100) 

Person 
---------- 
Id (PK) 
Code (char(4)) 
Year (int) 
GroupCode (char(4)) 

And I want a class for Person that looks something like this

class Person 
{ 
    public virtual int Id { get; set; } 
    public virtual string Code { get; set; } 
    public virtual Group Group { get; set; } 
} 

Now the Group class needs to be linked both by the GroupCode field and the Year field. I'm having difficulty figuring out how to set multiple keycolumns for my hasmany relationship each having a property- ref. Is this possible in NHibernate and if so is the feature available from fluent nhibernate?