Data Access Object

From Wikipedia, the free encyclopedia

In computer software, a Data Access Object (DAO) is a software component which provides a common interface between the application and one or more data storage devices, such as a database or file. The term is most frequently applied to the Object design pattern.

Contents

[edit] Advantages

Data Access Objects are a Core J2EE Design Pattern and considered best practice. The advantage of using data access objects is that any business object (which contains application or operation specific details) does not require direct knowledge of the final destination for the information it manipulates. As a result, if it is necessary to change where or how that data is stored that modification can be made without needing to change the main application.

Data Access Objects can be used in Java to insulate an application from the underlying Java persistence technology, which could be JDBC, JDO, EJB CMP, TopLink, Hibernate, iBATIS, or any one of a range of technologies. Using Data Access Objects means the underlying technology can be upgraded or swapped without changing other parts of the application.

[edit] Disadvantages

Flexibility has a price. When adding DAOs to an application, the additional complexity of using another persistence layer increases the amount of code executed during runtime. Configuration of persistence layers requires in most cases more work than writing a direct persistencifier that accepts Data Transfer Objects (DTOs).

[edit] See also

[edit] External links

[edit] Tools

  • DB Solo JDBC/EJB 3.0 DAO generator
  • Akcess (Free DAO-Generator) DAO tier generator
  • MDAOG DAO code generator for PostgreSQL databases
  • CodeFutures (Firestorm/DAO) DAO + DTO + Web Tier code generator for JDBC, EJB 2.0, JPA, Hibernate
  • JDBaccess: a Java persistence library that supports data access objects
  • Abator for iBATIS: a code generator for iBATIS