Oracle Logo

Example of Using the Criteria Query API

 

Criteria Query API Introduction

The criteria query API was added in JPA 2.0 and provides another way to query entities besides JPQL. By using some of the Java APIs supplied by the criteria query API, it is easy to construct dynamic queries. Additionally, the criteria query API supplies more compiling-time checks than JPQL.

Description of the Example

This example is based on an enterprise management scenario. Users can query by department name and by asset price to view a list of a department's assets above a certain price.

Use This Example

Team Name:
Above This Price: