ORM and JPA: the persistence context, dirty checking and N+1
The persistence context and first-level cache, the four entity states, persist vs merge, dirty checking and flushing, lazy vs eager loading, the N+1 problem and four ways to fix it: fetch joins, entity graphs, batch fetching and DTO projections.