5 topics · 0/5 read
JPA, Hibernate & Spring Data
The entity lifecycle and persistence context, relationships with lazy and eager loading, the N+1 problem, @Transactional propagation and isolation, and Spring Data repositories.
JPA and Hibernate: Entities and the Persistence Context
JPA is the Java persistence specification and Hibernate is its most used implementation. Interviewers ask about the entity lifecycle states, the persistence context (first-level cache), dirty checking, and save vs merge.
Read nowRelationships, Lazy vs Eager Loading and LazyInitializationException
Mapping @OneToMany, @ManyToOne and @ManyToMany correctly, and choosing lazy or eager fetching, decides most JPA performance. LazyInitializationException is the error every Spring developer meets, and interviewers ask why
Read nowThe N+1 Query Problem in JPA and How to Fix It
The N+1 problem is the most common JPA performance bug: one query loads N entities and then N more queries load an association for each. Interviewers expect you to recognise it and know several fixes.
Read now@Transactional: Propagation, Isolation and Rollback Rules
@Transactional is simple to add and easy to get wrong. Interviewers ask about propagation types like REQUIRED and REQUIRES_NEW, isolation levels, which exceptions roll back, readOnly, and why it sometimes silently does n
Read nowSpring Data JPA Repositories and Queries
Spring Data JPA generates repository implementations from interfaces. You should know derived query methods, @Query, projections, pagination, Specifications and auditing, and the limits of each.
Read now