Hmmmm,
Still find it confusing - but found the solution in the manual anyway. It is so simple - I think like I have looked like a cow staring to it's fence...
Anyway - the reason why I wanted 'Lifecycle' in the first place is because of what i see as a bug in Hibernate. Every time an object persists - I want an 'updateDate' field be set to the system time. Therefor I have mapped a <timestamp> like this:
Code:
<timestamp column="update_date" name="updateDate" unsaved-value="null"/>
But when updating an object for the first time - hibernate throws an error. The actual query generated by hibernate is something like:
Code:
Hibernate: update jms_external_listings set update_date=?, address=?, bla bla where id=? and update_date=?
I don't know the details about JDBC (MySQL) but in plain SQL this is wrong. Updating an object for the first time means the the timestamp is NULL. So the query in that case should not be "= null" but "is null".