I have a class Person which has a relation to PhoneNumber. The latter has to be a component. Person has two methods for the relation:
Quote:
public PhoneNumber getBusinessPhoneNumber()
and
public PhoneNumber getPrivatePhoneNumber()
PhoneNumber contains String attribute phoneNumberNational and country attribute, which is a Business Object.
I cannot beat the mapping problem with this:
Quote:
/**
* @hibernate.component
* @return
*/
public PhoneNumber getBusinessPhoneNumber() {
return businessPhoneNumber;
}
/**
* @hibernate.component
* @return
*/
public PhoneNumber getPrivatePhoneNumber() {
return privatePhoneNumber;
}
Code:
It results in only adding only two columns to the PERSON table: country and phoneNumberNational. But it should add two more columns, since I have a businessPhoneNumber and a privatePhoneNumber.
Can someone please tell me whats wrong? Or can someone tell me a full code example which solves the thing which I want to do?