-->
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.  [ 3 posts ] 
Author Message
 Post subject: Mapping in legacy schema, child tables use parent PK for Id
PostPosted: Wed Oct 13, 2004 8:38 pm 
Newbie

Joined: Mon May 10, 2004 2:28 pm
Posts: 10
Location: Seattle, WA
This is a real newbie question. I am the proud owner of "Hibernate in Action" but I haven't encountered the solution to this (not to say its not there just that I haven't seen it yet).

I have two tables PARENT and CHILD

Code:
PARENT

ID #
other columns


CHILD
PARENT_ID #
other columns


What is the correct way to map this? The CHILD rows are dependant on their PARENT row. The conceptual issue for me is I have to have an <id> tag in the child.hbm.xml but it isn't generated from a sequence, hilo or anything else; it comes from the parent. If I had to guess I would say that I should use the "assigned" value for the generator...

I am using Hibernate 2.1 against Oracle 8i.

Thanks for any suggestions


Ian.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 14, 2004 2:04 am 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
Guess you're looking for a 1:1 mapping where both sides do have the same primary key. If yes, read all of chapter 5.1.11 of the reference manual.

HTH
Ernst


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 14, 2004 11:39 am 
Newbie

Joined: Mon May 10, 2004 2:28 pm
Posts: 10
Location: Seattle, WA
Thanks Ernst, I'll do that.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.