-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: UserType assistance
PostPosted: Thu Nov 10, 2011 10:06 pm 
Newbie

Joined: Thu Nov 10, 2011 9:56 pm
Posts: 1
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 ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.