-->
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.  [ 2 posts ] 
Author Message
 Post subject: Primary Key with more than one column
PostPosted: Thu Jul 21, 2005 3:44 am 
Newbie

Joined: Thu Jul 21, 2005 1:28 am
Posts: 4
Hibernate version: 3.0

I fear I have overlooked the solution in the documentation or maybe I haven't understood the concept of Hibernate.

I have a table-structure with a lot of tables having primary keys with more than one column. eg:

Table person:
firstName
lastName
dayOfBirth
street
zip
city

with primary key firstName, lastName and dayOfBirth

and a table companyCar with a relation to the table person:
licensePlateNumber
carType
firstName
lastName
dayOfBirth
assetCost
netBookValue

As I understood, the primary Key would be set into the <id />-Tag inside the Mapping field - and this works fine with tables having only one column as primary key, but how will I create my mapping files for these two tables and the relation between both?

Yours

Christian


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 21, 2005 3:56 am 
Expert
Expert

Joined: Thu Dec 04, 2003 12:36 pm
Posts: 275
Location: Bielefeld, Germany
Use <composite-id>.
http://www.hibernate.org/hib_docs/v3/re ... ompositeid

Best regards
Sven


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

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.