This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I am a little confused about 1-1 mapping table structure. Generally you don't need 2nd table for storing this relationship since every record of one entity will map to only single record to other entity. But I have seen different implementation on different books/articles. Some prefer to store it in a single table and some prefer to store it in two tables!!!
Earlier I thought you just need to tell hibernate about the relationship and then it will decide how many tables will be created (I am wrong). But it is us who is doing so.
Please comment about these different implementations.
I think it is not a good approach to have a join table because the default fetch for OneToOne is EAGER, and it would required more joins to finish when searching for an entity if you do not set as LAZY.
If you do set as Lazy it would require one more join than the regular approach.