14 Integrating JPA and Hibernate with Spring

 

This chapter covers

  • Introducing Spring Framework and dependency injection
  • Examining the data access object (DAO) design pattern
  • Creating and generifying a Spring JPA application using the DAO design pattern
  • Creating and generifying a Spring Hibernate application using the DAO design pattern

In this chapter, we’ll analyze a few different possibilities for integrating Spring and Hibernate. Spring is a lightweight but also flexible and universal Java framework. It is open source, and it can be used at the level of any layer in a Java application. We’ll investigate the principles behind the Spring Framework (dependency injection, also known as inversion of control), and we’ll use Spring together with JPA or Hibernate to build Java persistence applications.

Note

To execute the examples from the source code, you’ll first need to run the Ch14.sql script.

14.1 Spring Framework and dependency injection

Spring Framework provides a comprehensive infrastructure for developing Java applications. It handles the infrastructure so that you can focus on your application, and it enables you to build applications from plain old Java objects (POJOs).

14.2 JPA application using Spring and the DAO pattern

14.3 Generifying a JPA application that uses Spring and DAO

14.4 Hibernate application using Spring and the DAO pattern

14.5 Generifying a Hibernate application that uses Spring and DAO

Summary

sitemap