Appendix A. Introducing Spring Data JPA
The Spring Data JPA website, http://projects.spring.io/spring-data-jpa/, has an opening paragraph that succinctly describes the problems of implementing a JPA-based DAO layer:
Implementing a data access layer of an application has been cumbersome for quite a while. Too much boilerplate code has to be written to execute simple queries as well as perform pagination, and auditing. Spring Data JPA aims to significantly improve the implementation of data access layers by reducing the effort to the amount that's actually needed. As a developer you write your repository interfaces, including custom finder methods, and Spring will provide the implementation automatically.
In Chapter 4, Data Access Made Easy, we implemented the DAO design pattern to abstract database persistence into a well-defined layer. We deliberately decided not to introduce Spring Data JPA in this chapter, as the target audience were intermediate developers who may not have...