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: How to insert data in two tables having foreign key
PostPosted: Fri Jan 16, 2009 3:44 am 
Newbie

Joined: Sun Jan 11, 2009 5:36 am
Posts: 1
Hi All,

I have a two tables A and B.
A columns: ID(PK), Name, Address
B columns: Age, Hobbies, ID_FK

Here ID_FK is the foreign key.
We dont have PK in B table and we cannot change the table structure..

Please help me how should I do mapping for these two tables in .hbm files to insert the data in both the tables..

Thanks in advance...
Raj


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 16, 2009 4:12 am 
Beginner
Beginner

Joined: Wed Nov 19, 2008 8:25 am
Posts: 46
Location: Saint Petersburg, Russian Federation
If your foreign key references A.ID you just need to use a dedicated foreign generator. Feel free to check the reference about unidirectional one-to-one association on a primary key example - '7.2.2. one to one'.


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.