|
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
|