The Artima Developer Community
Sponsored Link

Java Buzz Forum
Why use DAO layer with ORM solutions?

1 reply on 1 page. Most recent reply: Apr 7, 2005 3:25 AM by CodeFutures CodeFutures

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Marc Logemann

Posts: 594
Nickname: loge
Registered: Sep, 2002

Marc Logemann is founder of www.logentis.de a Java consultancy
Why use DAO layer with ORM solutions? Posted: Feb 28, 2005 7:52 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Marc Logemann.
Original Post: Why use DAO layer with ORM solutions?
Feed Title: Marc's Java Blog
Feed URL: http://www.logemann.org/day/index_java.xml
Feed Description: Java related topics for all major areas. So you will see J2ME, J2SE and J2EE issues here.
Latest Java Buzz Posts
Latest Java Buzz Posts by Marc Logemann
Latest Posts From Marc's Java Blog

Advertisement

I am really questioning the usage of a DAO layer in a J2EE app where you have also a business service layer and a ORM solution. DAO is a nice concept, but its main purpose is to shield developers from the SQL hell and add implementation change capabilities when you dont use ORM. So when using JDO or hibernate or whatsoever, you are duplicating nearly the same code, lets see:

Web ActionHandler: calls userService.getUsers()
userSerivce: calls userDAO.findAll(); (only line in getUsers())
userDAO: findAll() is a three liner with JDO statements

I cant see a problem to put the JDO stuff inside the userService Methods, because JDO itself is the needed abstraction normally got from DAOs. DAOs are extremely important when you dont have an ORM or general abstraction layer over SQL, because then you can swap a userDAO based on MySQL with a userDAO based on Oracle on application setup.

So right now i am evaluating to remove this DAO stuff, because it adds hundreds of classes and interfaces without much gain. If i want to change the database, i dont do it via changing the implementing DAO classes but with a JDO style configuration change. DAO would also make sense to abtract your application from the ORM product used, but how many times you change this in a big application. This lets me think of phantom requirements mentioned in "J2EE without EJB".

Read: Why use DAO layer with ORM solutions?


CodeFutures CodeFutures

Posts: 5
Nickname: codefuture
Registered: Sep, 2004

Re: Why use DAO layer with ORM solutions? Posted: Apr 7, 2005 3:25 AM
Reply to this message Reply
You may find this dicussion on "Data Access Object (DAO) versus Object Relational Mapping (ORM)" useful:


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

Flat View: This topic has 1 reply on 1 page
Topic: Some tips for using cvs with Jdeveloper Previous Topic   Next Topic Topic: Notes on Fearless Change

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use