[odb-users] Why do I get an odb::object_not_persistent error in this test program?

Boris Kolpackov boris at codesynthesis.com
Thu Oct 31 01:49:46 EDT 2013

Hi Daniel,

Daniel <daniel.the.programmer at gmail.com> writes:

> I now use database_global->reload(parents[0]); at the start of the 
> second transaction in server_thread().
> I wonder if this is the right solution?

A more efficient way would be what I described in my previous email:
only load object ids in the first transaction. For a more general
solution to this problem (i.e., long-lived application transactions),
you may want to take a look at optimistic concurrency (Chapter 12).

> Do I need to use a mutex here, or does this solution always work?

You can't really use a mutex here since it is the state of the object
in the database that is modified concurrently.


More information about the odb-users mailing list