I have a Car table and a Person table.
Car-table
-----------
car_id
licence_plate
Person-table
---------------
person_id
name
One person can own many cars. And one car can be owned by one person, or by two (or more) persons together. So I make an association table (link-table, xref-table) like this:
Car_Person-table
--------------------
car_id
person_id
I want to keep track of former owners of a car if the car is sold from one person to another. How do I do that? Perhaps by putting in start and end date into the Car_Person-table?
Car_Person-table
--------------------
car_id
person_id
start_date
end_date
How do I map this in Hibernate and what would the Java-classes look like?
|