In CompositeUserType, public Type[] getPropertyTypes() is defined using the Hibernate Type interface. This means you must define a Hibernate Type using Hibernate’s internal API in order to be able to map a Java type for use in property expressions.


What would need to be done to be able to map a Usertype for each property? My use case is the case of persisting an interval which is defined by two columns of type (Joda) DateTime, but currently the underlying type is TimestampType, so a Date or Timestamp has to be used in property queries. Would I need to define types to use for the properties along the lines of:


public class DateTimeType extends

              AbstractSingleColumnStandardBasicType<DateTime> implements

              LiteralType<DateTime> {


// Where mapping to timestamp is performed within this type.


Would there be a reasonable modification where instead a CompositeUserType could be defined as consisting of separate (Enhanced)UserTypes for each of its properties?


Regards Chris