O'Reilly logo

Spring MVC Cookbook by Alex Bretet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Configuring the Java Persistence API in Spring

Now that we have introduced JPA, its role, and the benefits of using Entities, we can now focus on how to configure our Spring application to handle them.

Getting ready

As we said earlier, the JPA is a specification. Choosing a persistence provider (Hibernate, OpenJPA, TopLink, and so on) or a database provider for an application won't be a commitment as long as they match the standards.

We will see that our JPA configuration in Spring is done by defining two beans: datasource and entityManagerFactory. Then, the optional Spring Data JPA library offers a JPA repository abstraction that is able to surprisingly simplify some database operations.

How to do it...

  1. From the Git Perspective in Eclipse, check out ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required