Chapter 11. JPQL

This chapter covers

  • Creating and executing queries
  • The Java Persistence Query Language
  • Leveraging the criteria API
  • Using SQL queries
  • Invoking stored procedures

Chapter 10 introduced the basics of the EntityManager API. You saw how to get an instance of EntityManager from the container and use it to perform the basic CRUD operations (create, read, update, delete) on entities. Create, update, and delete are relatively simple operations that chapter 10 covered in full. Read, however, is much more complicated because of the variety of ways to query database data.

In this chapter we’ll explore read in depth by looking at the Java Persistence Query Language (JPQL), the criteria API, and native SQL. Each method tackles the problem ...

Get EJB 3 in Action, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.