Hibernate version: 1.2 GA
Classes:
Let's say we have :
class Person {
PersonPk Id;
DateTime DateOfBirth
}
class PersonPk {
string FirstName,
string LastName,
}
Car {
int id
string Name,
double Price,
Person Owner, <<< how to map this ?
}
Tables
Person {
[PK] FirstName varchar(20),
[PK] LastName varchar(20),
DateOfBirth DateTime
}
Car {
[PK] Id int,
name varchar(20),
price double,
[FK] OwnerFirstName varchar(20),
[FK] OwnerLastName varchar(20)
}
Question
How do i write the Car's mapping to reference its owner. All documentations i've found seem to reference only class with single Id.
Note
1) I've tried things like
<class name=Car>
...
<many-to-one Name="Owner" class="Person" >
<column name="OwnerFirstName" />
<column name="OwnerLastName" />
</many-to-one>
</class>
but of course, nhibernate complains about this.
2) the classes and table schema are simplified to help you understant what i'm want to know.
_________________ =====
Nhibernate rox !
here is my (empty) blog
|