Hello
I am trying to have an update timestamp generated automatically in-database at every insert/update. I use a custom annotation using @ValueGenerationType as indicated in the in-database section of the Generated Values documentation (
http://docs.jboss.org/hibernate/orm/4.3/topical/html/generated/GeneratedValues.html), using
Code:
GenerationTiming.ALWAYS
in my value generation class.
The timestamp field gets correctly filled at object insert time, but does not get updated when I update the object. By logging the generated sql, I can see that current_timestamp is called to fill the field at insert time, but the timestamp field is completely ignored in the update.
I am using a StatelessSession for both the insert and update. If I change my code to use a regular Session, the problem remains the same.
Am I missing something? How can I get my timestamp to update automatically?
Thanks