I have an Hibernate entity which has a java.util.Date property. Instead of setting the property value to new Date() on my entity and then saving with Hibernate, I would like to make the database set the date through a SYSDATE() function. I want this because I can't rely on the date set by the client, because it is a swing app. I can only trust on the time taken from the database.
I have thought of some options, but both seem quite poor:
- Ask the database for the current time, set it on my object and then save. (expensive)
- Create an Hibernate insert statement and pass the parameters manually. (subverts the purpose of Hibernate)