Data Access object patterns or DAO patterns are used to decouple low-level data access APIs or operations from advanced business services. The following are participants in the data Access object pattern.
data Access Object Interface -this interface defines the standard operations to be performed on model objects.
data Access Object Concrete class -This class implements the above interface. This class is responsible for getting data from a data source, which can be a database/xml or any other storage mechanism.
model object or Value object -This object is a simple pojo that contains methods for storing data retrieved using the DAO class get/set
.
Implementing an instance
In this will create an object as a Model
or Value
object Student
. StudentDao
is the data Access object interface. StudentDaoImpl
is the concrete class that implements the interface of the data Access object. Daopatterndemo This is a demo class that will use the StudentDao
presentation using the data Access object pattern.
The structure of the data Access object pattern sample is as shown in-
Click on the link to view the details
Java data Access Object pattern