Quote:
if I make the Person_Id of the address object the Primary key and get rid of the sequence from the mapping, it should be good enough
You could do that, in fact if they are truly one-to-one you should do that. But I don't actually see any relationship mapped between your two classes. Where or how are you defining this one-to-one relationship?
I think you need to have a reference to the other class on at least one of them.
Code:
public class Person {
private Address address;
// ...
}
in person mapping:
Code:
<one-to-one name="address" class="test.Address" cascade="all" constrained="true"/>
Please carefully read section
4.1.11 one-to-one of the documentation.
If more than one person can have the same address you would need a many-to-one or if a person can have more than one address you would need a one-to-many but all of them require some kind of reference otherwise you are probably treating instances of your classes as values and not as entities with relationships.