Understanding Data Persistence, DAO, DTO Patterns and Client-Server Architecture

Download Presenatation
data persistence n.w
1 / 12
Embed
Share

Explore the concepts of Data Access Objects (DAOs), Data Transfer Objects (DTOs), and Client/Server Architecture in application development. Learn about the roles of DTOs in moving data, managing transactions, and best practices for handling connections in DAOs. Avoid common pitfalls in Service or Façade classes by considering key questions related to DAO methods and SQL exceptions.

  • Data Persistence
  • DAO
  • DTO
  • Client-Server Architecture
  • Transactions

Uploaded on | 1 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Data Persistence The DAO and DTO Patterns

  2. Client / Server Architecture 2

  3. Data Access Objects (DAOs) 3

  4. Data Access Objects (DAOs) 4

  5. Data Transfer Objects (DTOs) Data-only (plus accessors) classes used to move (or transfer ) data from point A to point B in an application Moving data into and out of the Data Persistence subsystem Create, Update, Delete: DTOs passed into DAOs Read: DTOs passed out of DAOs Transferring data between client and server (typically over a network) Web API parameters Web API results 5

  6. DAOs with DTOs 6

  7. Model Objects and DTOs 7

  8. Model Object Using DTOs 8

  9. Original Client / Server Architecture 9

  10. DAO / DTO Client / Server Architecture 10

  11. Transactions See TransactionManager.java example Service or fa ade does the following: Calls begin() Calls each DAO method to be included in the transaction Calls end(Boolean) (from within a finally block) (pass false if any of the DAOs threw an SQLException) Each DAO in the transaction calls getConnection()to use the same connection (and therefore be part of the same transaction) 11

  12. Questions to Consider Who calls the DAO methods? Should DAO methods throw SQL Exceptions? Why or why not? How do DAOs get connections? Why should this matter? What problem(s) do you see with the Service or Fa ade classes calling the TransactionManger? How can we avoid them? 12

More Related Content