C++ OR mapping - cross platform and db

Any good suggestions for something like that? i.e, Hibernate but for C++.

I am looking for a product/solution that can be used in production work, so it must be stable, supported etc.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Funny You Ask...

...as this is also critical for me. Unfortunately, the only open source system I've found that even comes close is the Database Template Library, and on UNIX it mostly serves to show how buggy most vendors' ODBC drivers are. It does work nicely with MySQL, though.

OR mapping for C++

Hello Paul,

As you said the DTL is not exactly an O/R mapping tool.

Does anybody know about any commercial tool for cross platform/db O/R mapping tool for C++?


Hi there...

Fancy seeing you here :-)

Write your own

This may sound daunting, but actually it is quite quick (a few days) and easy, (and supportable/extendable).

First decide what "one case" looks like, making decisions about Dynamic SQL vs Stored Procedures, etc. Decide on your Security and Transaction models. Decide on your object structure. Then write this for one case.

Now just extract the "fixed" vs "variable" portions. For the "variable" portions, write functions to produce them from an annotated schema, and perhaps some additional parameters.

You can write the functions in many languages. I use Lisp, but I have also written them in Scheme, Erlang and JavaScript. Anything with "eval" makes the code very simple.

Now just read the template file, write out literally until you find the "markers" (I use #~...~#). Between markers, "eval" and write out that. You now have your compilable source.

So there isn't any?

No tool matches the requirements?

I dunno...

...what are the requirements?


any commercial tool for cross platform/db O/R mapping tool for C++

used in production work, so it must be stable, supported etc.

find any?


Any luck find this type of solution? I'm looking for the same thing.



Nope :-(

Nope :-(

It doesn't meet the requirements but ...

... I've developed a library that provides relational views of collections of runtime objects (which can be C++ objects provided that a bit of reflective glue is implemented -- similar to providing a COM interface to an existing class). It actually implements a full relational database (with extension-points to defer to other RDBMs as necessary).

It's kind of tangential to what you're looking for, I guess. I made it to allow "update visible-objects set highlight = <blue> where type = <truck> and loyalty = <enemy>" in computer game code. Still I wonder if it would be worth it to make a sourceforge project out of it (and maybe work an OR mapping into it -- just a minor addition).

I've got a small demo on my website, if anybody might be interested in helping me turn it into a community project.