N+1 Reads Problem
Pool of Created
Objects or Beans
C
C
C
C
2
findByCity()
1
3
Returns collection
Persistence
Layer or EJB
Container
findByCity()
n
For each Customer
Fetch their Address
4
4
6
n
Container returns results
Address
5
5
If Address had related
objects, they too may be
fetched 2n+1 Reads!