O'Reilly logo

Servlet & JSP: A Tutorial, Second Edition by Budi Kurniawan

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

Chapter 15

Java Persistence API

As shown in the previous chapter, you can store the states of Java objects in a relational database using JDBC. While this approach works and is still widely used, Java Persistence API (JPA) offers another way of doing this. Internally, JPA uses JDBC, however it can create and update database tables and write SQL statements for you. With JPA, changing a database is just a matter of updating a configuration file. It can potentially make your life easier, but there is a learning curve to go through.

This chapter explains what JPA is, what benefits it offers and how to use it. Bear in mind that JPA is a complex technology and this chapter barely touches its surface.

JPA Overview

JPA specifies object-relational ...

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