Grokking Java Interview Questions
0% completed
Spring Data JPA and the N Plus One Problem
A page of the store lists 7 orders and the products in each one. The method behind the page calls a repository once, yet the database received 8 SQL statements in our run. After a change to one query, it received 1. The same code with 100 orders would send 101 statements, because the number grows with the data.
Nothing in the Java code shows these statements. The four questions explain where they come from: how loaded objects are tracked, when related objects are fetched, why a loop multiplies the fetches, and which changes reduce them.
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%