| DBRowUpdateException is thrown when a CoreDO update fails.
Two values are used to uniquely identify a row in a table:
oId and version.
The executeUpdate() method creates an SQL UPDATE command
to write the new values in a CoreDO object back to
the correct row in the database.
The row is identifed by the oId and version values specified
in the WHERE-clause of the UPDATE command.
So, if no row has the specified oId and version combination,
the UPDATE will fail, and report that 0 rows were updated.
Note: other database problems (e.g. disk full) can also cause
an UPDATE to fail, but these are rare.
When versioning == true, the executeUpdate() method will increment
the version number in both the CoreDO object and in the updated row.
When the same oId/version combination is used twice to create
two CoreDO objects (A and B) that refer to the same row,
it is possible for the version number of one of those objects
to become out-of-sync with the row in the database.
Object A is updated, and the version number in object A and
in the row is incremented.
When an attempt is made to update object B, the version number in
object B no longer matches the row in the database,
so the row is not found, and the update has no effect
(zero rows are updated).
In this case, the CoreDO.executeUpdate() method throws
a DBRowUpdateException describing the problem.
The application code that catches this exception
should probably reload the Data Object from the database.
version: $Revision: 1.1 $ See Also: CoreDO author: Jay Gunter |