Results 1 to 5 of 5

Thread: DAO or ORM or ?. objects <-> rdbms

  1. #1
    Join Date
    May 2006
    Posts
    70
    Thanks
    12
    Thanked 4 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default DAO or ORM or ?. objects <-> rdbms

    I'm designing a database app where I want clearly defined lines between my UI, Business Objects, and Data Access Layer. I've found a ton of Java material on the subject but almost no C++ material. And pretty near zero amount of Qt material on this. I'm creating a test program to flesh this idea out. The test program is a simple contact database with a single business object, the Contact object. I know DAO/ORM is overkill for this test program, but I'm doing this research for a much larger application.

    I first stumbled upon the DAO (Data Access Objects) design pattern and that seems to fit the bill. I have a rough implementation of DAO already (complete with factories) but the problem exists where I have to change my DAO factory interfaces and add a new DAO object for each Business object I create. This seems like a lot of extra work (which is ok if it's the only way to go.... but I'm always on the lookout for a "Better Way[TM]")

    I have discovered this website that explains how to make a generic DAO object (based on CRUD) so that when you implement a new database type (let's say CSV text files instead of sql) you only have to implement this generic DAO object. With Qt4 I would use the plugin architecture to provide generic libMysql.so, libCSV.so, ... plugins. This would be a beautiful solution in my eyes but that website is for Java and I have trouble making the leap to C++.

    This approach sounds very much like the ORM (object relational mapping) model to me. So I started to research ORM. Of course a ton of Java information abounds focusing a lot on Java's Hibernate libraries.

    Thinking ORM might be too much for me I tried messing around with C++ templating and generics. I managed to make a few changes to simplify the DAO layer but not a whole lot.

    So my questions are which way should I go? Is there a decent/easy-to-use ORM library for C++ (or more specifically Qt4)? Is there a better way to do DAO? Is there another method altogether?

    Remember I'm trying to stick to C++ and Qt4 and OpenSource if at all possible. It also has to be a cross-platform solution. Why is it the Java people have all the fun in this topic?

  2. #2
    Join Date
    Dec 2006
    Location
    Wuhan, China
    Posts
    14
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: DAO or ORM or ?. objects <-> rdbms

    I didn't heard any ORM solution for QT4.

  3. #3
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: DAO or ORM or ?. objects <-> rdbms

    Quote Originally Posted by darkadept View Post
    I'm designing a database app where I want clearly defined lines between my UI, Business Objects, and Data Access Layer.
    So my questions are which way should I go? Is there a decent/easy-to-use ORM library for C++ (or more specifically Qt4)? Is there a better way to do DAO? Is there another method altogether?

    Remember I'm trying to stick to C++ and Qt4 and OpenSource if at all possible. It also has to be a cross-platform solution. Why is it the Java people have all the fun in this topic?
    If you want to write open SOURCE,
    Why the complicated look, if it simply goes...

    SOAP (Simple Object Access Protocol) , XML-RPC (remote procedure call), DAO (Data Access Objects) ,

    http://en.wikipedia.org/wiki/SOAP
    http://de.wikipedia.org/wiki/Data_Access_Object
    http://en.wikipedia.org/wiki/XML-RPC

    that are all method based data to get or store data or Object.


    Today all Data can handle on XML ,
    Formally defined languages based on XML (such as RSS, MathML, GraphML, XHTML, Scalable Vector Graphics, MusicXML and thousands of other examples)
    & WDDX ( http://en.wikipedia.org/wiki/XML )
    ( http://en.wikipedia.org/wiki/WDDX exchange data ) and validate via
    http://en.wikipedia.org/wiki/RELAX_NG if necessary, and Binary data to ...
    or Extensible Stylesheet Language Transformations (XSLT) you can transform XML data to other
    format , like PDF, OpenOffice, Latex, Excel, and so much other,
    or directly write and read on the server via Webdav http://en.wikipedia.org/wiki/WebDAV
    without to change the firewall setting and Secure Socket Layer are possible.

    And we have Mysql ( mysql 5 Stored Procedure call ) or Object-Relational DBMS PostgreSQL
    or direct Database xml like DB2 express from IMB ... that are all opensource....
    And all known database can access on ODBC qt included.


    Why the complicated look?
    Last edited by patrik08; 18th March 2007 at 09:30.

  4. #4
    Join Date
    May 2006
    Posts
    70
    Thanks
    12
    Thanked 4 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: DAO or ORM or ?. objects <-> rdbms

    I guess what I'm asking is is there an simpler/easier/better way to separate the business objects from the data access layer that is easier than DAO and not as complex as ORM?

    SOAP (which seems to come from WDDX and XML-RPC) seems like a good way to talk between layers/processes/applications but it also seems really heavy for an in-house client/server database application.

    As for the different kinds of databases, I can't assume that my client uses backend X, Y, or Z. Or even which platform that will be. Since my projects usually incorporate other data from different sources I don't want my UI and business objects knowing about which backend i'm using.

    The more I research this and plot out different courses it seems that creating a DAO object for every business object is a good way to go. ORM would be nice but I don't have the time to code up my own Qt4 implementation.

  5. #5
    Join Date
    Jul 2009
    Posts
    22
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: DAO or ORM or ?. objects <-> rdbms

    It is a very late to reply , I hope you don't mind. I have made a Qt ORM library call DQuest released under New BSD open source license . I wish you like it.

    http://code.google.com/p/d-quest/

Similar Threads

  1. closing file objects of pending requests in QHttp
    By nisha0609 in forum Qt Programming
    Replies: 1
    Last Post: 18th January 2007, 10:52
  2. static objects in libraries
    By Rawk in forum Qt Programming
    Replies: 3
    Last Post: 16th January 2007, 19:03
  3. dealing individual objects
    By kingslee in forum General Programming
    Replies: 9
    Last Post: 15th November 2006, 01:28
  4. Replies: 7
    Last Post: 18th July 2006, 21:33
  5. Help me to use QtSharedMemory to share the data objects
    By gtthang in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2006, 11:50

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.