I have one class:
Car {
- id:int
...
- color:String
}
And two tables storing the information:
CAR [
ID:INTEGER (PK)
...
COLOR_ID:INTEGER (FK)
]
COLOR [
ID:INTEGER (PK)
NAME:STRING
]
I've been trying to map the Car class to both tables, without any success.
First i tried it with a <join>, but it'd only work if a had the foreign key in the COLOR table, refering to the primary key of CAR (and i have it the other way around: the CAR fk refering to the COLOR pk).
Then i tried with the <many-to-one>, but Hibernate requires two classes for it, Car and Color.
Does anybody know how to do it without changing the classes and the tables?
Thanks a lot,
Luiz.
|