• 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:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

DTO & DAO

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI ,
Have a good day...

what is the advantage of DTO & DAO ?
I cant understand.

Thanks in anticipation.

Yours faithfully,
Nimish
 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A DTO is basically an object to bundle other objects together in order to transport them.

E.g. A client needs to get a customer object and a shopping trolley object for that customer.

In stead of making two calls to the server, one for the customer and one for the trolley, the client makes one call. These two objects are put into a DTO object on server side and then passed to the client where both objects can be extracted from this one DTO.

DAO encapsulates database operations so that there is a uniform way of getting the database to do stuff. This data layer is therefore reusable. Another advantage of this modularity is that any frontend that knows how to use this uniform way can tap into the database.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Scheepers de Bruin:

DAO encapsulates database operations so that there is a uniform way of getting the database to do stuff. This data layer is therefore reusable. Another advantage of this modularity is that any frontend that knows how to use this uniform way can tap into the database.



And in fact you can write DAO's that don't work on a database but on XML, flat files or a myriad of other persistence mechanisms. Your business logic doesn't even to know, you just give it a new DAO implementation to collaborate with.
 
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic