- Data Access Object
:"This article is about the Data Access Object design pattern in object-oriented software design, not about the
Data Access Objects library from Microsoft."Incomputer software , a Data Access Object (DAO) is an object that provides an abstract interface to some type ofdatabase or persistence mechanism, providing some specific operations without exposing details of the database. This isolation separates the concerns of what data accesses the application needs, in terms of domain-specific objects and data types (the public interface of the DAO), and how these needs can be satisfied with a specific DBMS, database schema, etc. (the implementation of the DAO).This design pattern is equally applicable to most programming languages, most types of software with persistence needs and most types of database, but it is traditionally associated with J2EE applications and with relational databases accessed via the JDBC API because of its origin in Sun Microsystems' best practice guidelines [cite web
title = Core J2EE Patterns - Data Access Objects
publisher = Sun Microsystems Inc.
date = 2002
url = http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html
date = 2007-08-02] ("Core J2EE Patterns") for that platform.Advantages
The advantage of using data access objects is the relatively simple and rigorous separation between two important parts of an application which can and should know almost nothing of each other, and which can be expected to evolve frequently and independently.Changing business logic can rely on the same DAO interface, while changes to persistence logic do not affect DAO clients as long as the interface remains correctly implemented.
In the specific context of the Java programming language, Data Access Objects can be used to insulate an application from the particularly numerous, complex and varied Java persistence technologies, which could be JDBC, JDO, EJB CMP,
TopLink , Hibernate,iBATIS ,openJPA or many others. Using Data Access Objects means the underlying technology can be upgraded or swapped without changing other parts of the application.See also
*
Data Transfer Object
*Design Patterns
*Object-relational mapping
*Service Data Object External links
* [http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html Core J2EE Patterns - Data Access Object]
* [http://nils.kilden-pedersen.net/DAO_pattern/InnerClassStrategy.html Inner Class strategy]
* [http://www.codefutures.com/weblog/andygrove/archives/2005/02/data_access_obj.html Data Access Objects versus Object Relational Mapping]Tools
* [http://code.google.com/p/persist/ Persist] Java-based ORM tool
* [http://www.dbsolo.com DB Solo] JDBC/EJB 3.0 DAO code generator
* [http://mdaog.sourceforge.net MDAOG] DAO code generator forPostgreSQL databases
* [http://www.codefutures.com CodeFutures] (Firestorm/DAO) Generator for JDBC DAO, Spring DAO, Hibernate DAOFrameworks
* [http://jingdao.sourceforge.net/ JingDAO] Java based DAO framework
References
Wikimedia Foundation. 2010.