I have an object graph, sent from a remote client, that I need to write into a database, but only if the value of the "lastUpdate" attribute is greater than the current "last_update" column value in the database.
ie.
update doc_tbl set name=?, last_update = ?
where id=? and last_update <= ?
If last_update fails the compare, it is also an indicator to us that none of the embedded entities should be updated, either, so I don't want any updates to be attempted on related tables.
I looked into using a timestamp version, such as this:
<version column="last_update" name="lastUpdate" type="timestamp"/>
but sql gets generated like this:
update doc_tbl set name=?, last_update=?
where id= and last_update=?
so I'm not sure if that is the right idea to pursue.
Can someone point me in a direction to get started?
Thanks,
K
|