The following code works except that when I fetch the data and look at it in the eclipse debugger, I see that the hours, minutes, seconds have been zeroed for my lastUpdatedDate field.
When I check the value "recent" the hours, minutes and seconds are definitely non-zero!
Can someone tell me how to preserve these values?
Thanks,
Siegfried
Code:
Calendar recent = Calendar.getInstance();
recent.setTime(IN_RANGE_RECENT);
Session session = sessionFactory.openSession();
session.createQuery("update BacklogOrder set lastUpdatedDate = :recent, customerId = :custId where orderId=:orderId")
.setCalendarDate("recent",recent)
.setString("orderId", "order")
.setString("custId", "siegfried")
.executeUpdate();
session.flush();
session.close();
List<BacklogOrder> bList = tstBacklogDao.getBacklogOrdersBetweenDates(END_RANGE, BEGIN_RANGE);
Here is the entity:
Code:
/**
*
*/
package cashback.entities;
@Entity
@Table(name="CASHBACK_ORDER_BACKLOG")
public class BacklogOrder {
....
private String orderId;
private String customerId;
private String marketplaceId;
private Date orderDate;
private BacklogStatus state;
protected Date lastUpdatedDate;
/**
* Gets the updated date.
*
* @return the last updated date
*/
@Column(name="last_updated", nullable=true, updatable=false)
public Date getLastUpdatedDate() {
return lastUpdatedDate ;
}
/**
* Sets the order date.
*
* @param orderDate the new order date
*/
protected void setLastUpdatedDate(Date lastUpdatedDate) {
this.lastUpdatedDate = lastUpdatedDate;
}
}