Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Benefits of ORM vs DAO?

 
Unnsse Khan
Ranch Hand
Posts: 511
  • Mark post as helpful
  • send pies
  • 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
 
Loren Rosen
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • 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.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • 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.
 
Dave Clark
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • 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
 
Pj Murray
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic