|
Hibernate version:1.2.1
I'm trying to map a legacy database containing 3 tables:
Person (PersonId, Name)
Employee (EmployeeId, PersonId, EmployeeNumber)
Assignment (EmployeeId, Department, StartDate, EndDate)
I'd like to map Employee as a joined-subclass of Person, but I can't get the one-to-many association from Employee to Assignment to work. When I try
<set name="Assignments">
<key column="EmployeeId"/>
<one-to-many class="Assignment"/>
</set>
NHibernate generates joins between Assignment.EmployeeId and Employee.PersonId, when what I want is a join between Assignment.EmployeeId and Employee.EmployeeId. I tried
<key column="EmployeeId" foreign-key="EmployeeId"/>
but it made no difference. Digging through the code, it appeared that the foreign-key attribute was being ignored completely.
Is there any way to do what I want?
_________________ Mike Abraham
|