ORM and c++

M

martini

hello, I´m looking for a open source ORM (Object-relational mapping)
framework for c++, I searched google for hours, but I could not find a
good framework similar to hibernate, or gentler.net for dot net
platform, Does any body know a good one? thank you .....
 
?

=?iso-8859-1?q?Kirit_S=E6lensminde?=

martini said:
hello, I´m looking for a open source ORM (Object-relational mapping)
framework for c++, I searched google for hours, but I could not find a
good framework similar to hibernate, or gentler.net for dot net
platform, Does any body know a good one? thank you .....

Our FOST.3 framework is in the process of being open sourced. It should
be on a more general release early next year. In the meantime we'd be
interested to talk to people who would be interested in using it and we
will give out early versions to people we can talk to about the issues
surrounding open sourcing it.

It runs on Windows and has a number of other useful features apart from
the O/RM.

Its web site is at http://fost.3.felspar.com/ - not a very extensive
site yet I'm afraid.


K
 
Joined
Jun 13, 2008
Messages
1
Reaction score
0
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,610
Members
45,255
Latest member
TopCryptoTwitterChannels

Latest Threads

Top