Hi all
I have Hibernate entity class User that contain "statusDate",
When I persist the object to the DB I do:
Code:
User user = new User();
user.setStatus(ACTIVE);
user.setStatusDate(new Date());
User user = new User();
user.setStatus(ACTIVE);
user.setStatusDate(new Date());
So I am reading the date & time from the local machine.
Is there any way I can update the statusDate with oracle's date and time?
I want to avoid native query like:
Code:
INSERT INTO " user " ("name", "status","statusDate") VALUES ("Sharon", "ACTIVE", SYSDATE)
I can not change database at all, so all the setting has to happen in hibernate. i try to use formula with annotation, but if I set the
Code:
@formula("sysdate")
private Date statusDate;
both the select and insert will use the current date. how to solve this