I'm new to NHibernate and I'm having problem mapping a legacy database with composite keys.
The database looks like this (I've removed all unneccesary info):
Kpi
------
(PK) kpiId : int
KpiColumn
------------
(PK) kpiId : int
(PK) position : int
with foreign key to Kpi
KpiData
----------
(PK) kpiId : int
(PK) position : int
(PK) counter : int
with foreign key to KpiColumn (kpiId and position)
PK means Public Key above.
Here are the classes:
Code:
class Kpi {
int id;
IList kpiColumns;
}
class KpiColumn {
IList kpiData;
}
class KpiData {
}
How would the mapping look like? I'm kind of stuck.. I tried a solution with list of composite-element for Kpi to KpiColumn. But I didn't know how to continue with KpiColumn to KpiData.
/Carl