Listing 11.4. Meta-model class produced by the meta-model annotation processor
The class in this listing has static properties that you'll use to provide static typing when
building a query. The criteria query API makes extensive use of generics that when com-
bined with the static class ensure that your queries are correct and will execute. Now it's
time to start digging into the CriteriaBuilder .
The CriteriaBuilder is at the heart of the JPA criteria API. It's responsible for cre-
ating criteria queries, component selections, expressions, predicates, and orderings. It's the
factory class that you'll use to construct your query leveraging the static meta-model. You
acquire a reference to the CriteriaBuilder by calling the getCriteriaBuild-
ferent types of queries that can be created using the CriteriaBuilder .
Table 11.10. Create methods on CriteriaBuilder
Creates a new criteria object
Creates a new criteria object with a specific return type
Creates a new criteria object that will return a tuple as its
Creates a new criteria object for performing bulk delete op-
createCriteriaDelete( Class<T> targetEntity)