JOIN FETCH with Hibernate - The end of n+1 select issues

  Рет қаралды 3,076

Thorben Janssen

Thorben Janssen

Күн бұрын

Пікірлер: 20
@pasvupaspris303
@pasvupaspris303 3 ай бұрын
thanks for taking your time to educate us
@Thorben-Janssen
@Thorben-Janssen 3 ай бұрын
happy to help
@paulobarata6377
@paulobarata6377 3 ай бұрын
Thx for the fantastic videos
@Thorben-Janssen
@Thorben-Janssen 3 ай бұрын
Thanks for watching, Paul!
@andtif
@andtif 3 ай бұрын
Thanks
@Thorben-Janssen
@Thorben-Janssen 3 ай бұрын
Thanks for watching
@alexsmart2612
@alexsmart2612 3 ай бұрын
The end of n+1 select issues - not so fast. As soon as you add a limit, offset to do pagination, hibernate will pull the ENTIRE resultset in memory and do the aggregation in memory. I know you know this problem because I have read a bunch of articles from you on this. The recommendation from you on those articles iirc is to use two queries, one to fetch only ids of the entity root and second to actually fetch the fully hydrated entity graph. That's the solution I have been using in my own production code base.
@Thorben-Janssen
@Thorben-Janssen 3 ай бұрын
That's one of the pitfalls I'll talk about in this week's video :)
@MarceloDanielSales
@MarceloDanielSales 3 ай бұрын
As always, thanks for the excellent material. When you plan to release a book about hibernate 6?
@Thorben-Janssen
@Thorben-Janssen 3 ай бұрын
Good question. I'm currently concentrating on the Persistence Hub (thorben-janssen.com/join-persistence-hub/), and I don't have the time to write an entire book. Maybe I reconsider that next year. But then the book would be about Hibernate 7 (or maybe 8) :)
@Thorben-Janssen
@Thorben-Janssen Ай бұрын
I'm currently very busy with clients and the Persistence Hub. If I write a new book, it will be about Hibernate 7 (currently in "release candidate" state) or 8.
@EmiliaKaida
@EmiliaKaida 3 ай бұрын
So what are the other approaches (if any) to solve this n+1 issue? In the past I've read some articles here and there listing some approaches, but they just glossed over it and I also pretty much forgot them all. Would be best if there's an overview of the ways 😁
@Thorben-Janssen
@Thorben-Janssen 3 ай бұрын
I'll talk about the other one in the next video 😁 I'll publish it next week
@erikgollot6331
@erikgollot6331 3 ай бұрын
Have a look at @BatchSize
@erikgollot6331
@erikgollot6331 3 ай бұрын
@BatchSize
@Thorben-Janssen
@Thorben-Janssen 3 ай бұрын
That's more a workaround than an alternative. (@)BatchSize always requires additional queries. Depending on your (@)BatchSize configuration and the size of the relationship, this might be more than 1 additional query.
@umairalvi7382
@umairalvi7382 2 ай бұрын
Are you muslim ?? At 1:43 I noticed the background of a mosque.
@Thorben-Janssen
@Thorben-Janssen 2 ай бұрын
No, I'm not :) I just liked the picture and thought that the almost endless row of pillars matched the queries in the n+1 select issue. I wasn't aware it was the picture of a mosque.
@umairalvi7382
@umairalvi7382 2 ай бұрын
@Thorben-Janssen ohh okay. That's very thoughtful
Что-что Мурсдей говорит? 💭 #симбочка #симба #мурсдей
00:19
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
Avoid these Mistakes - Fetching Relationships with Hibernate
13:24
Thorben Janssen
Рет қаралды 1,5 М.
Algorithms Explained for Beginners - How I Wish I Was Taught
17:38
Internet Made Coder
Рет қаралды 391 М.
Discover How LLMs Work by Dissecting Llama
9:53
Julia Turc
Рет қаралды 579
SQLite and the N+1 (no) problem
8:30
Mycelial
Рет қаралды 9 М.
Hibernate & JPA Tutorial - Crash Course
24:27
Marco Codes
Рет қаралды 125 М.
JPA & Hibernate: Basic Annotations You Need To Know
15:11
Thorben Janssen
Рет қаралды 32 М.
Database Indexing for Dumb Developers
15:59
Laiture
Рет қаралды 89 М.