-->
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: One-to-one Association Question [2]
PostPosted: Tue Jul 24, 2007 7:37 pm 
Newbie

Joined: Mon Jun 12, 2006 1:26 pm
Posts: 3
Location: Minneapolis, Minnesota
Hi All,
I have been following the Hibernate Annotation document and have been experimenting with the one-to-one relationship to see which one fits for me. I definitely did not go with the association table because that is definitely not the way. I am doing the first one which is one-to-one association using shared primary keys. Everything is working when it comes to code but when I looked at the database, the two tables are not linked with the foreign as expected and I would like it that way so it will help with the data integrity. I have two tables, the primary one is User and the secondary one is User_Info. Every User will have one User_Info so when a User table is created, an associated User_Info with the same id will be created. I tried the bi-directional method, but some how I am not doing it right. Every User will have a User_Info so I put the foreign key in the User_Info and follow the examples but that does not work. I changed it the other way around and it created a new key in the User table and not using it's primary key as the User_Info's foreign key. I think I am confused, if someone could enlightening me on this one-to-one situation, it is greatly appreciated.


Thanks,
Doug


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.