课程: Learning JDBC
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solution: Implement a DAO
(upbeat music) - [Instructor] So now it's time for my solution to this challenge exercise. So I started by creating an entity called Customer. And in this entity, I have the six fields that are represented by the database table, a customer ID of type UUID, and then five strings, first name, last name, email, phone, and address. Now, technically, email is a unique field. So, we can take that into account when we build our DAO if we choose to. So let's go take a look at the customer DAO itself. So we have a GET_ALL, a GET_ONE, a CREATE, an UPDATE, and a DELETE. Again, if you wanted to add a GET_ONE by email address, you could have done that. I chose not to. The operations look very similar to what we did for the service. So we have a create, a delete, a getAll, a getOne, an update, and then the processResultsSet like we did before. So now if you go into your app, I've added into this all of the data for customers. So if I run this, and I expand my window here a little bit, you'll see…
内容
-
-
-
-
(已锁定)
Using a driver7 分钟 4 秒
-
(已锁定)
The Data Access Object (DAO) pattern4 分钟 44 秒
-
(已锁定)
Understanding result sets6 分钟 38 秒
-
Reading all data5 分钟 54 秒
-
(已锁定)
Reading instance data5 分钟 7 秒
-
(已锁定)
Creating data7 分钟 10 秒
-
(已锁定)
Updating data4 分钟 14 秒
-
(已锁定)
Deleting data3 分钟 35 秒
-
(已锁定)
The Repository pattern4 分钟 32 秒
-
(已锁定)
Challenge: Implement a DAO1 分钟 12 秒
-
(已锁定)
Solution: Implement a DAO2 分钟 1 秒
-
(已锁定)
-
-