Skip to main content
1:1 mock interviews with Sumit, scored on a real hiring rubric.Book a slot →

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.

  1. 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 now
  2. Relationships, 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 now
  3. The 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
  4. @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 now
  5. Spring 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