[hibernate-users] Custom Type Mapping for Properties of Composite Type
Christopher Pheby
chris at jadira.co.uk
Tue Apr 22 19:39:25 EDT 2014
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-users/attachments/20140422/2bff9d7e/attachment.html
More information about the hibernate-users
mailing list