I created a component phoneNumber with a countrycode, an areacode and a localphoneNumber. I store this as a string :
/**
* @return Returns the phoneNumber.
* @hibernate.property
* length = "20"
* unique = "false"
* update = "false"
*/
public String getPhoneNumber() {
return countryCode + "_" + areaCode + "_" + localPhoneNumber;
}
I use this in an other class like this :
/**
* @return Returns the phone1.
* @hibernate.component
* prefix = "phone1_"
*/
public PhoneNumber getPhone1() {
return phone1;
}
It workes well, but can I create a criteria where I search only the countrycode ? How do I do this ?
Hibernate 2:
MySQL:
|