Hibernate Tip: How to implement a subquery in a CriteriaQuery

preview_player
Показать описание

One of the readers of my blog asked me the following question: In one of our use cases, we use the Criteria API to build the query dynamically. Now I need to add a subquery. Does the Criteria API support subqueries? And how can I implement them?
Yes, you can use sub queries in your CriteriaQuery and I will show you how in this video. But before we jump in, please subscribe to this channel and turn on the notification so that you don’t miss any future Hibernate tips.

If you like this video, please give me your thumbs up and share it with your friends and co-workers.

Like my channel? Subscribe!

Join the free Member Library:

Want to connect with me?
Рекомендации по теме
Комментарии
Автор

Do you need to join them? I’m trying to do a not in to retrieve records that’s not on the other table

Cons
Автор

Hi Sir, your video and explanation is very helpful.

amidalashiva
Автор

Thanks for sharing! Question for you... what's the underscore? e.g. Book_.authors, Author_.id, etc.

gamatossian
Автор

How can we do something similar to a subquery in the select using critaria API, I already heard you say it can't be done, but is there any trick with criteria API that we can simulate a subquery in a select?. Thanks
Well, I think it would be referencing a column from a join with the other table.

compartelo
Автор

How to get columns with embedded entity

akshaypande