【发布时间】:2015-11-07 06:48:07
【问题描述】:
我想在休眠中使用 JodaTime LocalDate。我是这样写的:
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "DATE_DEBUT", nullable = false)
@Type(type = "org.joda.time.contrib.hibernate.PersistentLocalDate")
private LocalDate dateDebut;
但它没有用。我收到此错误:
Caused by: Exception [EclipseLink-7165] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The type [class org.joda.time.LocalDate] for the attribute [dateDebut] on the entity class [class ch.test.application.beans.mandat.Mandat] is not a valid type for a temporal mapping. The attribute must be defined as java.util.Date or java.util.Calendar.
你知道为什么吗?
谢谢
【问题讨论】:
-
您使用的是什么版本的 Hibernate 和 JodaTime?向我们展示 Maven POM 的相关部分。
-
您意识到您根本没有使用 Hibernate,而是使用 EclipseLink? EclipseLink 不会打扰 Hibernate 类型和注释。
标签: java hibernate jpa jodatime