Ctrl K
Java · Mid-level · Theory

You notice that the order list page runs hundreds of SQL queries. What could be causing it on the JPA side, and how would you fix it?

~4 min by voice

How to approach it

This checks whether you recognize the N+1 problem in JPA/Hibernate, can prove it with measurements, and know several ways to fix it along with their limitations: pagination, multiple collections and EAGER.

Have you seen this question in a real interview?
Answers0
Avg. score—
Strong—
Practiced0
Topics
Similar questionsWhat is the N+1 problem in Hibernate, how do you detect it, and what ways do you have of solving it? What are the trade-offs of each approach? SeniorOnce a day you need to import a CSV with several million rows into the database through an existing JPA layer. How would you design the import so it doesn't run out of memory and finishes in time? Mid-levelOnce a day you need to process tens of millions of rows from the database and recompute data based on them, in Java with Spring and JPA. How would you design that processing? SeniorWhere does LazyInitializationException come from, and how do Hibernate's first-level and second-level caches affect working with entities? Mid-level

Answer by voice

The interviewer will ask this question and listen. Think out loud and ask for a hint if you need one. When you're done, pause or tap “That's my answer”. In about a minute, your score and the points you covered show up here.

Sign in to answer

Best with headphones · ~4 min