如果我们使用怎么办
@Column(name="birth_date", nullable=false, length=19)
public Date getBirthDate() {
return this.birthDate;
}
代替
@Temporal(TemporalType.TIMESTAMP)
@Column(name="birth_date", nullable=false, length=19)
public Date getBirthDate() {
return this.birthDate;
}
如果我们使用日期列属性而不使用日期列属性,是否会有任何副作用@Temporal
注解?
我设法找到的唯一一份文档:
在普通的 Java API 中,时间的时间精度未定义。在处理时态数据时,您可能希望描述数据库中的预期精度。时态数据可以具有 DATE、TIME 或 TIMESTAMP 精度(即实际日期、仅时间或两者)。使用 @Temporal 注释对其进行微调。
From 2.2.2.1.声明基本属性映射 http://docs.jboss.org/hibernate/annotations/3.5/reference/en/html/entity.html#entity-mapping-property.
This might表示数据库中的实际日期表示尚未定义,并且最好直接指定它。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)