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 Bidirectional, not mapped on primary key
PostPosted: Tue May 12, 2009 11:33 am 
Newbie

Joined: Tue Jul 25, 2006 10:52 am
Posts: 2
I tried to google and search for an answer to this issue, but I could not find an definitive answer -- so sorry in advance if this has been handled before.

I have two tables. Let's call them Person and Address as follows:

Person: id username name
Address: id username street number

In these tables, id is the primary key for both tables. username is some unique identifier for a person, but is NOT a primary key. However, username is the mapping between the two tables, and so the only way to figure out the address of a person is to search on the username column in the address table. (Don't ask me why it was designed this way -- I came into a legacy system).

The relationship between the person and the address is one-to-one.

I would like to create a bidirectional hibernate mapping, such that a Person object has its address and an Address object has its related person.

What is the correct xml that will configure this kind of mapping?

Thanks!

Yoel Spotts


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.