11 Generic DAOs and refactoring
-
Continue with the project from the previous chapter. It contains the classes as you left them there.
-
In this assignment you will refactor the DAOs so they use the generic
AbstractDAO. Copy or download this file and add it to your project. Both DBaccess and AbstractDAO are now generic classes that you can use everywhere. -
Make
DepartmentDAO,PersonDAOandEmployeeDAOsubclasses ofAbstractDAO. -
Rewrite the methods in the three specific DAOs so they use the
AbstractDAO. -
Test your DAOs by running the chapter 10 code again. You must remove the HR row from the
departmenttable in Workbench, otherwise you will get an error. You will see that you can add the employee Lodewijk to your database twice without problems.