Using the Criteria API
The Criteria API provides a way of creating type-safe queries. Its type-safe quality is the result of the Java compiler's ability to perform syntax checking at compile-time and the run-time environment's ability to catch and handle exceptions. Using this API can result in more robust and stable applications.
The Criteria API is a complex API. Complete coverage is not possible here. The intent is to provide an introduction to its use.
The essential steps in creating and using a Criteria API-based query are:
- Creating an instance of the
- Using this instance to create an instance of a
CriteriaQueryclass containing a query
- Executing the query
How to do it...
There are two basic approaches for using ...