O'Reilly logo

Pro JPA 2: Mastering the Java™ Persistence API by Merrick Schincariol, Mike Keith

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 9. Criteria API

In the last chapter, we looked in detail at the JP QL query language and the concepts that underlie the JPA query model. In this chapter, we will look at an alternate method for constructing queries that uses a Java programming language API instead of JP QL or native SQL.

We will begin with an overview of the JPA 2.0 criteria API and look at a common use case involving constructing dynamic queries in an enterprise application. This will be followed by an in-depth exploration of the criteria API and how it relates to JP QL.

A related feature of the criteria API is the JPA 2.0 metamodel API. We will conclude this chapter with an overview of the metamodel API and look at how it can be used to create strongly typed queries using ...

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