在Hibernate 5.1中存储Joda LocalDateTime和LocalDate并全局映射
我需要将在Hibernate 5.1中存储Joda LocalDateTime和LocalDate并全局映射,hibernate,jpa,jodatime,Hibernate,Jpa,Jodatime,我需要将LocalDate存储到DATE中,将LocalDateTime存储到DATETIME/TIMESTAMP中。我正在使用Hibernate5 我已经读到,我应该在每一列上使用@Type注释,它是有效的。但我想尝试将碰巧是LocalDateTime的所有列立即映射为TIMESTAMP 我已经在我的package info.java中进行了尝试 @org.hibernate.annotations.TypeDefs({ @org.hibernate.annotations.T
LocalDate
存储到DATE
中,将LocalDateTime
存储到DATETIME/TIMESTAMP
中。我正在使用Hibernate5
我已经读到,我应该在每一列上使用@Type
注释,它是有效的。但我想尝试将碰巧是LocalDateTime
的所有列立即映射为TIMESTAMP
我已经在我的package info.java中进行了尝试
@org.hibernate.annotations.TypeDefs({
@org.hibernate.annotations.TypeDef(defaultForType = org.joda.time.LocalDateTime.class, typeClass = org.joda.time.contrib.hibernate.PersistentLocalDateTime.class, name = "LocalDateTime"),
@org.hibernate.annotations.TypeDef(defaultForType = org.joda.time.LocalDate.class, typeClass = org.joda.time.contrib.hibernate.PersistentLocalDate.class, name = "LocalDate"), //
})
没有结果
有什么想法吗