Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

what is the difference between DTO and DAO

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can, anyone explain the differences between DTO and DAO.

It would be better if explained with an example.

Thanks,
kantha
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the OO and Design Patterns forum.

This forum is for Servlets only questions, please try to post your thread in the most appropriate forum, and not just the first one on the list. (It's the morning, and I not a good morning person, that is why this sounds grumpy. Sorry.)

Mark
 
Mark Spritzler
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Different is an "A" and a "T".

DAO is a class that usually has the CRUD operations like save, update, delete. Whereas the DTO is just an object that holds data. It is really a glorified JavaBean with instance variables and setter and getters. Usually it is the DTO that is passed to the save method of a DAO.

Data Access Object (DAO)
Data Transfer Object (DTO).

But check out the link posted above, I am sure it goes into much more detail.

Mark
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See also http://faq.javaranch.com/view?DataTransferObject and http://faq.javaranch.com/view?DataAccessObject
 
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DTO is also commonly known as VO or Value Object.

 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Paul Michael Laborte:
DTO is also commonly known as VO or Value Object.



Value Object is the old name for the J2EE pattern. The J2EE patterns team hadn't noticed that there already was a Value Object pattern with a different meaning in popular use. When they discovered that their pattern also already existed under the name of Data Transfer Object, they decided to rename it to Transfer Object for J2EE... :roll:
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DAO contains the implementation of Data calls say insert ,update ,delete but DTO's are mere accessors ie, getters and setters used to fetch the data...
 
    Bookmark Topic Watch Topic
  • New Topic