Wt  3.7.1
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>

Inheritance diagram for Wt::Dbo::StaleObjectException:
Inheritance graph

Public Member Functions

 StaleObjectException (const std::string &id, const char *table, int version)
- Public Member Functions inherited from Wt::Dbo::Exception
 Exception (const std::string &error, const std::string &code=std::string())
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.

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

Generated on Tue Dec 15 2020 for the C++ Web Toolkit (Wt) by doxygen 1.8.13