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
|