Content deleted Content added
Adding/improving reference(s), Grammar edit |
Tonymarston (talk | contribs) m Add reference to the DAO being part of the 3-Tier Architecture. |
||
Line 11:
| date = 2007-08-02
}}</ref> "Core J2EE Patterns".
This object can be found in the [[Multitier_architecture#Common_layers|Data Access layer]] of the [[Multitier_architecture|3-Tier Architecture]].
There are various ways in which this object can be implemented:
* One DAO for each table.
* One DAO for all the tables for a particular DBMS.
* Where the SELECT query is limited only to its target table and cannot incorporate JOINS, UNIONS, subqueries and Common Table Expressions (CTEs)
* Where the SELECT query can contain anything that the DBMS allows.
== Advantages ==
Line 24 ⟶ 33:
== Disadvantages ==
Potential disadvantages of using DAO include [[leaky abstraction]],{{Citation needed|reason=What kind of leak?|date=August 2014}} [[Duplicate code|code duplication]], and [[abstraction inversion]]. In particular, the abstraction of the DAO as a regular Java object can obscure the high cost of each database access. Developers may inadvertently make multiple database queries to retrieve information that could be returned in a single operation. If an application requires multiple DAOs, the same create, read, update, and delete code may have to be written for each DAO.<ref>See http://www.ibm.com/developerworks/java/library/j-genericdao/index.html for workarounds</ref>
Note that these disadvantages only appear when you have a separate DAO for each table and the SELECT query is prevented from accessing anything other than the target table.
== Tools and frameworks ==
|