我在用着:
Eclipselink 2.5.0
HSQLDB 2.3
JPA 2.1
Spring 4.0.5
我有这个实体:
@Entity
public class MyEntity {
...
@Temporal(TemporalType.DATE)
@Convert(converter = MyLocalDateTimeConverter.class)
private LocalDate date;
}
当 HSQLDB/Eclipselink 生成 DDL 时,它生成 dabase 字段为:
TIMESTAMP
当我访问(通过选择)这个实体时,我的转换器得到 ajava.sql.Timestamp
而不是java.sql.Date
并将值转换为 aLocalDateTime
而不是LocalDate
。
如何强制将字段生成为:
DATE // respecting the Temporal definition