views:

1335

answers:

5

Using a DB with C++ is a real mess and it was refreshing when I moved to Java to be able to use a unified system to abstract the whole layer away (aka Hibernate).

There are a couple of C++ abstract layers for DB's out there but they are usually vendor specific and only a thin layer that wraps the real C API. Has anybody come across something more like hibernate for C++ or know of a group or open source project that is looking at this problem domain.

A: 

If you're using C++ with .Net, then use nhibernate. 2.0 is approximately the same as hibernate 3.0, and is extremely robust.

+2  A: 

I don't know of any C++ library like Hibernate, but certainly there are non-vendor specific libs: SOCI and DTL

Vadim Ferderer
+1  A: 

I feel your pain. You'll quickly be using separate libraries for database access, XML processing, threading, and everything else applications commonly need. For this reason I often use Qt, which provides most common functionality often need in programs (database access, XML processing, threading, GUI widgets, etc.). Their SQL classes are pretty decent and work with many databases. But it does not abstract SQL away like many object-relation mappers.

danieldk
soon, standard answers to question do not only include "boost" but also "Qt" haha. +1
Johannes Schaub - litb
A: 

Another approach is a C++ object <-> xml mapping like codesynthesis xsd
I never liked the direct hibernate/serialisation approach it breaks too much if you ever need to change the class.

Martin Beckett
A: 
Boris Kolpackov