Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DAO & DTO Difference?

 
Akhilesh Trivedi
Ranch Hand
Posts: 1599
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between Data Access Object and Data Transfer Object?
 
Joe Harry
Ranch Hand
Posts: 10122
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A DAO is where you can ask for data and with a DTO you transfer the asked data from one layer to another.
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A Data Access Object abstracts and encapsulates logic needed to access a given data source, such as a relational database, and performs these data access operation on behalf of a business object. See CoreJ2EE Patterns - Data Access Object for more details.

A (Data) Transfer Object is basically a (serializable) data container that encapsulates the (partial) state of a business object. So, a DAO may use a DTO to transfer the persistent state of a business object to and from a particular data source. See CoreJ2EE Patterns - Transfer Object for more details.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With other words, the only thing they have in common is that they both have the words "Data" and "Object" in their name.
 
Akhilesh Trivedi
Ranch Hand
Posts: 1599
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks everyone.
Jelle, is that complete book online or its just a catalog?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic