I know it is an old thread, but I thought I would add this in case someone else has the same question.
There is a new, open-source, compiler-based ORM system for C++ called ODB. The big difference between ODB and the other libraries mentioned above is that ODB allows you to persist C++ objects to a relational database without manually writing any mapping code.
The C++ code that performs the conversion between persistent classes and their database representation is automatically generated by the ODB compiler. The ODB compiler is a real C++ compiler except that instead of producing assembly or machine code, it generates portable C++ which can in turn be compiled by any C++ compiler.
Here is an example of a persistent class declaration in a C++ header:
Code:
#pragma db object
class person
{
...
private:
friend class odb::access;
person ();
#pragma db id auto
unsigned long id_;
string first_;
string last_;
unsigned short age_;
};
Given this class, we can perform various database operations with its objects:
Code:
person john ("John", "Doe", 31);
person jane ("Jane", "Doe", 29);
transaction t (db.begin ());
db.persist (john);
db.persist (jane);
result r (db.query (query::last == "Doe" && query::age (cout, "\n"));
jane.age (jane.age () + 1);
db.update (jane);
t.commit ();
ODB is cross-platform and cross-database. Check it out.