I've got a table with two columns I would like to be populated automatically via Hibernate:
- modified_date
- creation_date
It probably goes without saying that I'd like to have the creation_date populated automatically only when the row is first inserted, and modified_date to be populated automatically every time the row is modified.
Additionally, I would like the date to come from the db itself, not the VM
From my reading, I think the creation_date one is impossible. Am I correct?
For the modified_date, I thought this line would work:
Code:
<timestamp name="modifiedDate" column="modifed_date" source="db" generated="always"/>
But it doesn't seem to work. My modified_date column is still null after I insert a record. Anyone know what I'm doing wrong? Got an example hbm.xml file that would point me in the right direction? Thanks.
-j