Hello,
I am changing a mapping from a component to a one-to-one type. Here is my question, because I had a hard time with this before.
I have two classes
Code:
class Person{
private long id;
private Address address;
...
/**
* Returns the address.
* @hibernate.one-to-one name="getAddress"
class="foo.ejb.user.AddressBean"
* cascade="all"
* constrained="true"
* @return AddressBean
*/
public AddressBean getAddress() {
return address;
}
}
class Address{
long id
...
/**
* Returns the id.
* @hibernate.id generator-class="foregin" type="long" column="id"
* unsaved-value="-1"
* @return long
*/
public Long getId() {
return id;
}
}
Is this correct? My understanding is that when I save person that the id would also be assigned to address. Any help would be great!
---jason