[odb-users] Completing Transactions in the callback function of a persistent class

Boris Kolpackov boris at codesynthesis.com
Fri Aug 19 10:07:00 EDT 2011


Hi Eric,

Sum, Eric B <eric.b.sum at lmco.com> writes:

> I am trying to make odb an transaction for querying and then deleting the
> result of that query on the post-persist event of the callback function of a
> persistent class.  To do this, I need to include the proper header files
> such as odb/database.hxx and odb/transaction.hxx.  However, when I include
> these files in the header file of the persistent class(where the callback
> function is) or in a different header file included by that persistent
> class's header file, I get lots of errors when I run the odb compiler on the
> persistent class's header file.

You need to move the body of the callback function to the source file
instead of definiting it inline in the header. 

Generally, you cannot use database operations in the header file because
for them you need to include the -odb.hxx file. But that file has not yet
been created when the ODB compiler is compiling the header.

Boris



More information about the odb-users mailing list