Wt: Wt::Dbo::StaleObjectException Class Reference

Wt 3.3.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions
Wt::Dbo::StaleObjectException Class Reference
Database Objects (Wt::Dbo)

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

`#include <Wt/Dbo/Exception>`

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

List of all members.

## Public Member Functions
| StaleObjectException (const std::string &id, int version)
| Constructor.

## 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 ?

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator