• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Benefits of ORM vs DAO?

 
Ranch Hand
Posts: 511
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are the benefits of object relational mapping vs. using data access objects (DAO)? Why is a ORM framework such as Hibernate getting such notice?

Cheers,

Unnsse
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The primary reason is that with DAOs you have end up with a large amount of tedious and error-prone JDBC code to write. An ORM tool saves all that. Secondary reasons are that you can more easily be independent of a specific RDBMS, and that you reduce the number of developers on your project who need a thorough understanding of SQL.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also note that the DAO pattern and Hibernate are not mutually exclusive. You can very well use the DAO pattern to hide from your application code the fact that you've implemented "UserDAO" using Hibernate and not, say, raw JDBC.
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
another good reason to an ORM solution is ease of maintenance. It's a lot easier to change a single XML mapping file if you need to tweak your database schema rather than go back and find, modify, and debug all your hand-written SQL statements if you're using DAOs.

And you'll get all of the benefits of hibernate with a JDO implementation, except that JDO has multiple open source and commercial implementations, and is based on a <strong>standard</strong> rather than providing a single-vendor (i.e. proprietary) API.

cheers,

Dave
 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

There's a detailed Blog posting on

"Data Access Object (DAO) versus Object Relational Mapping (ORM)"

posted here by Andy Grove, CTO, CodeFutures:


http://www.codefutures.com/weblog/andygrove/archives/2005/02/data_access_obj.html


Regards
PJ Murray
CodeFutures
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic