-->
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: Is a delegating UserType feasible?
PostPosted: Wed Jun 22, 2005 11:18 pm 
Newbie

Joined: Fri Jun 11, 2004 4:58 pm
Posts: 9
I would like to persist a map of values. Each value element in the map may be typed as a string, integer, date, or one of a handful of types that will likely require custom UserTypes.

I'd like not to create a new persistent class hierarchy that corresponds to these types just so I can get them into the same collection. But if I don't, then how do I instruct Hibernate to build the appropriate Java types when a record is read from the data store?

I've considered a UserType that delegates to the built-in hibernate types and to my UserTypes, but this approach is problematic when extracting an object from a RecordSet in nullSafeGet. How will I know how which delegate can handle the invokation (i.e. is it a String or a PhoneNumber)?

Judging by the fact that this just doesn't feel right, I think I'm on the wrong path here. Any suggestions are appreciated.


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.