I've figured out why this is happening by looking at Hibernates SQL:
update EID.CIVILIANS set CIV_UPDATE_BY = 'John', CIV_UPDATE_DT=?, CIV_FNAME=? where CIV_ID=? and CIV_UPDATE_DT=?
if the CIV_UPDATE_DT is null then it should be:
CIV_UPDATE_DT is ? not CIV_UPDATE_DT=?
The database updates 0 rows because of this and Hibernate throws a row mismatch exception, which gets converted to a StaleObjectStateException. Is there any fix for this? Putting CIV_UPDATE_DT in the where clause doesn't seem necessary if Hibernate has already done the check.
|