What is the difference between DAO and DAL?

The Data Access Layer (DAL) is the layer of a system that exists between the business logic layer and the persistence / storage layer. A DAL might be a single class, or it might be composed of multiple Data Access Objects (DAOs). It may have a facade over the top for the business layer to talk to, hiding the complexity of the data access logic. It might be a third-party object-relational mapping tool (ORM) such as Hibernate.

DAL is an architectural term, DAOs are a design detail.


A data access layer will contain many data access objects.

It's primary role is to decouple the business logic from the database logic and implementation.

For example the DAL may have a single method that will retrieve data from several tables, queries or stored procedures via one or more data access objects.

Changes to the database structure, DAOs, stored procedures or even database type should not incur changes to the business logic and this is down to the decoupling provided by the DAL.