If for some reasons the update fails, no Exception is
thrown. Specifically, if an update is called on a
Persist that does not have a record which yet, the
update fails silently.
Would it be possible to have update throw an Exception
if no records are updated? The underlying update
statements (at least in JDBC) do in fact return codes
and values depending on what their outcomes are.
Logged In: YES
user_id=563250
If an update fails and setCheckZeroUpdate(false) is on, then the fact
that zero records are updated is ignored. If you say
setCheckZeroUpdate(true) it would fail with an exception if zero
records are affected.
The default on setCheckZeroUpdate was *false*, meaning the silent
failure was the default behaviour. I propose we change it so it's true
by default - but this will have implications: if you call update on a
record *which has no changes*, it will throw an exception unless you
explicitly call setCheckZeroUpdate(false) first.
This may affect existing code, so watch out for it! On the other hand,
it will stop code hitting the database unnecessarily :-)
Updating zero records is different from an actual SQL failure: this will
always throw an exception (even as the code is now).