Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java DAO design pattern category?

Which category (Creational, Structural or Behavioral) does a Java DAO design pattern falls into?

like image 837
Nital Avatar asked Oct 19 '25 15:10

Nital


2 Answers

Java DAO design pattern is a part of layered architecture and single Responsibility problem where dao should only handle the DB related stuff.

It can not be classified under java design pattern i.e Creational, Structural or Behavioral

like image 141
M Sach Avatar answered Oct 21 '25 06:10

M Sach


DAO is Data access object to retrieve and store data. DAO's can be combined with other design patterns such as MVC(Model View Controller) where the DAO's can act as the models. DAO is pretty similar to models and POJO(Plain Old Java Object).

DAO is not a design pattern in itself (though some consider it to be a J2EE design pattern) but it can be used to implement other design patterns. So you cannot classify it in the three major categories of design patterns.

From Wikipedia :

In computer software, a data access object (DAO) is an object that provides an abstract interface to some type of database or other persistence mechanism. By mapping application calls to the persistence layer, DAO provide some specific data operations without exposing details of the database. This isolation supports the Single responsibility principle. It separates what data accesses the application needs, in terms of domain-specific objects and data types (the public interface of the DAO), from how these needs can be satisfied with a specific DBMS, database schema, etc. (the implementation of the DAO).

like image 20
Pritam Banerjee Avatar answered Oct 21 '25 04:10

Pritam Banerjee



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!