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

Поділитися
Вставка
  • Опубліковано 17 гру 2024

КОМЕНТАРІ • 20

  • @paulobarata6377
    @paulobarata6377 2 місяці тому +1

    Thx for the fantastic videos

  • @MarceloDanielSales
    @MarceloDanielSales 2 місяці тому

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

    • @Thorben-Janssen
      @Thorben-Janssen  2 місяці тому

      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  6 днів тому

      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.

  • @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.

  • @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 :)

  • @andtif
    @andtif 2 місяці тому +1

    Thanks

  • @umairalvi7382
    @umairalvi7382 11 днів тому

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

    • @Thorben-Janssen
      @Thorben-Janssen  7 днів тому

      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 7 днів тому

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