If the DAO layer manages the persistence of data, given the data models and Spring JDBC's JdbcTemplate
and SimpleJdbcInsert
, the service layer, on the other hand, exposes all DAO transactions through its own set of interfaces and implementations. This recipe will close the whole chapter regarding how to assemble a Spring MVC application.
This last recipe requires us to use ch03-jdbc
to implement a service layer which contains native services for EmployeeDao
and DepartmentDao
transactions.
For @Controllers
to execute some DAO transactions and business-related logic, add the service layer by following these steps:
- After ensuring that the DAO layer is ready for use, add two more packages to contain our service interfaces and implementation. All interfaces must be in
org.packt.dissect.mvc.service
and their implementation must be saved insideorg.packt.dissect.mvc.service.impl
. - Create the following interfaces that will be...