Wt  4.0.2
Public Member Functions | List of all members
Wt::Dbo::StaleObjectException Class Reference

Exception thrown when Wt::Dbo detects a concurrent modification More...

#include <Wt/Dbo/Exception.h>

Inheritance diagram for Wt::Dbo::StaleObjectException:
Inheritance graph
[legend]

Public Member Functions

 StaleObjectException (const std::string &id, const char *table, int version)
 Constructor.
 
- Public Member Functions inherited from Wt::Dbo::Exception
 Exception (const std::string &error, const std::string &code=std::string())
 Constructor.
 
std::string code () const
 A (backend-specific) error code. More...
 

Detailed Description

Exception thrown when Wt::Dbo detects a concurrent modification

Wt::Dbo uses optimistic locking for detecting and preventing concurrent modification of database objects. When trying to save an object that has been modified concurrently by another session, since it was read from the database, this exception is thrown.

This exception is thrown during flushing from Session::flush() or ptr::flush(). Since flushing will also be done automatically when needed (e.g. before running a query or before committing a transaction), you should be prepared to catch this exception from most library API calls.

Note
We should perhaps also have a ptr::isStale() method to find out what database object is stale ?

Generated on Fri Nov 24 2017 for the C++ Web Toolkit (Wt) by doxygen 1.8.11