npryce/maybe-java

Hibernate user type for storing Maybe<T> values

npryce opened this issue · 2 comments

unknown -> null
known -> actual value

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.

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.