Implementing the DAO layer using the Spring JDBC Framework
After identifying the appropriate DataSource implementation, we are now ready to establish the database transactions in our Spring MVC application.
Getting Started
Open again the ch03-jdbc project and verify if MySQL 5.7 is updated and working fine. Also, check again if the DataSource implementation is appropriate for your application.
How to do it...
It is always the best practice to design the database and table schemas using an ERD model. After finalizing our schema designs, follow these steps to build our DAO layer:
- Let us open a MySQL workbench or a command line terminal, log in using the
usernamerootandpasswordspring5mysql, and create the following schema definition of thehrsdatabase:
- Since we will be dealing with database models, create a package,
org.packt.dissect.mvc.model.data, that will contain data models representing the schema of the preceding tables. Given the two tables, create theEmployeeandDepartmentdata models...