From the course: Learning JDBC
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
The Data Access Object (DAO) pattern
From the course: Learning JDBC
The Data Access Object (DAO) pattern
- [Narrator] One of the oldest patterns in dealing with data access is the DAO pattern. To do data access, there are several objects that you need to start with, especially in either the DAO pattern or the repository pattern. The purpose of this is to provide an abstraction between JDBC and the rest of your code. It can be just abstraction or it can be a true object. It really depends on your use case. I tend to favor the abstraction aspect, but again, that's just a personal preference. Most of the time we will use a DTO with a DAO. The DTOs are nothing more than data transfer objects that are used to store state between the layers. This is very similar to the way that we do a repository pattern. But with DAOs, sometimes people try to combine the DTO and the DAO into a single thing to be more object oriented. That is simply a matter of preference. I do prefer to keep them separate. The whole purpose of doing this is it provides a clear separation of your concerns within your code. By…
Contents
-
-
-
-
(Locked)
Using a driver7m 4s
-
(Locked)
The Data Access Object (DAO) pattern4m 44s
-
(Locked)
Understanding result sets6m 38s
-
Reading all data5m 54s
-
(Locked)
Reading instance data5m 7s
-
(Locked)
Creating data7m 10s
-
(Locked)
Updating data4m 14s
-
(Locked)
Deleting data3m 35s
-
(Locked)
The Repository pattern4m 32s
-
(Locked)
Challenge: Implement a DAO1m 12s
-
(Locked)
Solution: Implement a DAO2m 1s
-
(Locked)
-
-