maybe-java icon indicating copy to clipboard operation
maybe-java copied to clipboard

Hibernate user type for storing Maybe<T> values

Open npryce opened this issue 14 years ago • 2 comments

unknown -> null known -> actual value

npryce avatar Nov 23 '10 17:11 npryce

The user type needs to return the JDBC types used to map the given class to the database. But due to type erasure when Hibernate is presented with a Maybe<String> it will appear at runtime to be just a Maybe. So this looks to me to be a much harder problem than just writing a User Type.

nespera avatar May 23 '11 21:05 nespera

You'll need to configure the wrapped type in the mapping for the property. I've done it for other types. It's a minor pain but does work.

npryce avatar May 23 '11 21:05 npryce