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.
Joins with JPQL - JPA Tutorial
From the course: Java Persistence with JPA and Hibernate
Joins with JPQL
- [Instructor] Oftentimes, you'd want to fetch data from more than one table, that is in ORM terms, from more than one entity. For example, all the books and the authors who've written them. In this case, you have to join the two entities, book and author, in the FROM clause. In this example, there's a one-to-one relationship between the book and author, that is a book has an author who wrote it. Let's first clean up the database by running the mariadb.init.sql script, and then run the mariadb-07_02.sql script to set up some data. There are four books in the book table, but only three of them have an author. Let's assume that the author is not entered for the fourth book. Let's start with a simple inner join to list the books and authors and their addresses. The Book entity has its details, as well as the author reference in it, which has a one-to-one relationship with author. Also, the author has an address, which is embedded. But in the database, the author table holds the address…
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)
-
-