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.
|