本文主要是介绍保存Date类型到Oracle10g数据库,时分秒不见了,只有年月日,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
保存Date类型到Oracle10g数据库,时分秒不见了,只有年月日?
解决办法:将实体类中相应的get和set方法上面的注解DATE改为TIMESTAMP就可以了!
@Temporal(TemporalType.DATE)
@Column(name = "STARTDATE", length = 7)
public Date getStartdate() {
return this.startdate;
}
public void setStartdate(Date startdate) {
this.startdate = startdate;
}
@Temporal(TemporalType.DATE)
@Column(name = "ENDDATE", length = 7)
public Date getEnddate() {
return this.enddate;
}
public void setEnddate(Date enddate) {
this.enddate = enddate;
}
==================================
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "STARTDATE", length = 7)
public Date getStartdate() {
return this.startdate;
}
public void setStartdate(Date startdate) {
this.startdate = startdate;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "ENDDATE", length = 7)
public Date getEnddate() {
return this.enddate;
}
public void setEnddate(Date enddate) {
this.enddate = enddate;
}
这篇关于保存Date类型到Oracle10g数据库,时分秒不见了,只有年月日的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!