What is the N+1 query problem and how do you fix it in Hibernate?
Strong answer
One query loads N parent rows and then accessing a lazy association on each parent issues one more query per row. Fix it per use case with a JOIN FETCH query, an @EntityGraph, or @BatchSize/default batch fetching, and verify the fix by asserting the number of executed statements.
