I am having trouble with defining global TypeDef annotations in package-info.java. I have defined three user types for Joda time. I have registered these in package-info.java as so:
Code:
@org.hibernate.annotations.TypeDefs({
@org.hibernate.annotations.TypeDef(
name="local_date_time",
typeClass=JodaLocalDateTimeUserType.class
),
@org.hibernate.annotations.TypeDef(
name="local_date",
typeClass=JodaLocalDateUserType.class
),
@org.hibernate.annotations.TypeDef(
name="local_time",
typeClass=JodaLocalTimeUserType.class
)
})
When I try and use a LocalDateTime in my domain objects it is only mapped correctly if I add another annotation @org.hibernate.annotations.Type(type="local_date_time") to each instance. Is this necessary? I was expecting to be able to define my TypeDef once and for it to become this default convertor for LocalDateTime. Is that possible? I am taking this from page 134 of Java Persistence with Hibernate.
Thank you,
Martin