From the course: Java Persistence with JPA and Hibernate
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Criteria queries - JPA Tutorial
From the course: Java Persistence with JPA and Hibernate
Criteria queries
- [Instructor] JPQL queries, named queries, and native queries are different ways in which you can query the database when using an ORM framework, like Hibernate. Criteria queries are yet another way of querying. These are sometimes known as dynamic queries. When you have a lot of filter criteria in your query, for instance, if you are writing some search logic in your application, you wouldn't exactly know what parameters you'll need to pass your query. In this kind of a situation, you cannot use JPQL queries, but criteria queries are there for your rescue. So criteria queries are specifically helpful if you don't know in advance what filter criteria you have in your query. The criteria API allows to build up a query programmatically where different filter rules and logical conditions can be applied to it. Let's check out a simple example first. Before you begin, you should run the mariadb-init.sql script and mariadb-07_07.sql script. In the Main class, criteriaQueries method, you…
Contents
-
-
-
-
-
-
-
-
-
(Locked)
JPQL queries10m 47s
-
(Locked)
Joins with JPQL9m 11s
-
(Locked)
Named queries5m 15s
-
(Locked)
Aggregate functions8m 43s
-
(Locked)
ORDER BY, GROUP BY, and HAVING9m 17s
-
(Locked)
Native queries5m 11s
-
(Locked)
Criteria queries12m 8s
-
(Locked)
Challenge: Art Class Management app, part 51m 4s
-
(Locked)
Solution: Art Class Management app, part 55m 19s
-
(Locked)
-
-