I have a class which contains:
@Column(name = "end_date")
private Date endDate;
and its setter
public void setEndDate() {
endDate = new java.sql.Date(Calendar.getInstance().getTime().getTime());
System.out.println(endDate);
}
When I'm calling the setter, and check again if the value is correct, everything's fine.(even getEndDate().getClass()
).
However, when I'm saving my object into PostgreSQL (myObject.persist()
), there's no value on END_TIME column. Other values are correct.
Does anyone know what's the problem?
Also, I have to mention that hibernate is set to create SQL tables
Setter and getter:
public void setEndDate(Date endDate) {
setEndDate();
}
public Date getEndDate() {
return endDate;
}
try this it will work
@Column(name = "END_TIME")
private Date endDate = new Date();
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Date getEndDate() {
return endDate;
}