Hey everyone. I'm having trouble migrating my Server from JDBC persistence to Hibernate. I'm using Google's PHONENUMBERLIB, as a member in my Pojo that I want to persist. I'm trying to create a UserType class for PhoneNumber but the problem I have is that the PhoneNumber constructor takes two arguments. one is the actual phone-number in String, and the other is the owner country, also in String. The are both persisted in the same table, but they are not tightly coupled. Basically, the table looks like this.
Person: ====== ID - int PHONENUMBER - VARCHAR(16) COUNTRY - VARCHAR(2) ...
The phonenumber class is from Google's PHONENUMBERLIB, and it doesn't hold the country, it just uses that initially for construction. I need to use the country in various other aspects and I want it to be persisted on it's own and not as part of a composite type.
What is the best approach to solve this ?
|