2 Starting a project

This chapter covers

  • Introducing the Hibernate and Spring Data projects
  • Developing a “Hello World” with Jakarta Persistence API, Hibernate, and Spring Data
  • Examining the configuration and integration options

In this chapter, we’ll start with the Jakarta Persistence API (JPA), Hibernate, and Spring Data and work through a step-by-step example. We’ll look at the persistence APIs and see the benefits of using either standardized JPA, native Hibernate, or Spring Data.

We’ll begin with a tour through JPA, Hibernate, and Spring Data, looking at a straightforward “Hello World” application. JPA (Jakarta Persistence API, formerly Java Persistence API) is the specification defining an API that manages the persistence of objects and object/relational mappings—it specifies what must be done to persist objects. Hibernate, the most popular implementation of this specification, will make the persistence happen. Spring Data makes the implementation of the persistence layer even more efficient; it’s an umbrella project that adheres to the Spring framework principles and offers an even simpler approach.

2.1 Introducing Hibernate

2.2 Introducing Spring Data

2.3 “Hello World” with JPA

2.3.1 Configuring a persistence unit

2.3.2 Writing a persistent class

2.3.3 Storing and loading messages

2.4 Native Hibernate configuration

2.5 Switching between JPA and Hibernate

2.6 “Hello World” with Spring Data JPA

2.7 Comparing the approaches of persisting entities

Summary

sitemap