-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Many-to-Many and history (eg ownership of cars)
PostPosted: Thu Oct 02, 2008 9:30 am 
Newbie

Joined: Thu Oct 02, 2008 9:15 am
Posts: 3
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.