c# - Multple Composite PrimaryKey reference as foreign key map in Fluent nHibernate -
this legacy table structure hence no schema modification possible. patient ------- code - pk hospitalcode - pk - fk hospital.code hospitalgroup - pk - fk hospital.hospitalgroup other fields hospital ------- code - pk hospitalgroup - pk - fk hospitalgroup.code other fields department ------- code - pk hospitalcode - pk - fk hospital.code hospitalgroup - pk - fk hospitalgroup.code other fields diagnose ------- patientcode - pk - fk patient.code hospitalcode - pk - fk hospital.code hospitalgroup - pk - fk hospital.hospitalgroup departmentcode - pk - fk department.code other fields the mapping looks following public class patientmap : classmap<patient> { public patientmap() { compositeid() .keyproperty(x => x.id, "id") .keyreference(x => x.hospital, "hospital_id", "hospitalgroup_id") .keyreference(x => x.hospitalgroup, "hospitalgroup_id"); map(x => x.name);