I have a TIMESTAMP column in a table that is null when the record is initially inserted. I would like to update the value to the current time. My generated object has a given method for the field as such:
setCloseDate(Timestamp closeDate)
However, I do not want to generate / specify a timestamp from java code. Is there a way to annotate an attribute to indicate the use of current time at the database level when saving an object?
If not, what is a good strategy to carry out such an update?
Under the covers, the query I want to run is as follows:
update CASE_FILE set CLOSE_DATE=CURRENT_TIMESTAMP where ID=1
I'm just getting started with JPA ... so there might be something pretty obvious here. Thanks!
Scott nelson
source share