DAO design pattern is used in the data persistent layer of a Java
application. It mainly uses OOPS principle of Encapsulation.
By using DAO pattern it makes the application loosely coupled and
less dependent on actual database.
We can even implement some in-memory database like H2 with
DAO to handle the unit-testing.
In short, DAO hides the underlying database implementation from
the class that accesses the data via DAO object.
Recently we can combine DAO with Spring framework to inject any
DB implementation.
https://www.digitalocean.com/community/tutorials/dao-design-pattern