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

Поделиться
HTML-код
  • Опубликовано: 15 дек 2024

Комментарии • 20

  • @paulobarata6377
    @paulobarata6377 2 месяца назад +1

    Thx for the fantastic videos

  • @pasvupaspris303
    @pasvupaspris303 2 месяца назад +1

    thanks for taking your time to educate us

  • @EmiliaKaida
    @EmiliaKaida 2 месяца назад +1

    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  2 месяца назад +3

      I'll talk about the other one in the next video 😁
      I'll publish it next week

    • @erikgollot6331
      @erikgollot6331 2 месяца назад

      Have a look at @BatchSize

    • @erikgollot6331
      @erikgollot6331 2 месяца назад

      @BatchSize

    • @Thorben-Janssen
      @Thorben-Janssen  2 месяца назад

      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.

  • @MarceloDanielSales
    @MarceloDanielSales Месяц назад

    As always, thanks for the excellent material. When you plan to release a book about hibernate 6?

    • @Thorben-Janssen
      @Thorben-Janssen  Месяц назад

      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  5 дней назад

      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.

  • @andtif
    @andtif 2 месяца назад +1

    Thanks

  • @alexsmart2612
    @alexsmart2612 Месяц назад

    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  Месяц назад

      That's one of the pitfalls I'll talk about in this week's video :)

  • @umairalvi7382
    @umairalvi7382 10 дней назад

    Are you muslim ?? At 1:43 I noticed the background of a mosque.

    • @Thorben-Janssen
      @Thorben-Janssen  6 дней назад

      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 6 дней назад

      @Thorben-Janssen ohh okay. That's very thoughtful