Loading tutorials
Author who has many Book entries. It has one collection and one single-valued association, so it can show every fetching problem we need. This chapter defines the model, explains each mapping decision, and sets up a seeded database. L5 min read@Entity, @Id, @OneToMany, @ManyToOne), Spring Data JPA repositories, and basic SQL. It builds on the Author and Book model from the previous chapter. The persistence context explains most of the surprising SQL you see in a Spring Boot applicat6 min readAuthor and Book model from the earlier chapters. It explains what "lazy" and "eager" mean in JPA, what the defaults are, and why the choice decides how many SQL statements your applica7 min read@Entity, @OneToMany, @ManyToOne), Spring Data JPA repositories, and SQL joins. It uses the Author and Book model from earlier chapters. You have seen how authorSummaries() issues one query for the authors and then one query per author to l5 min readJOIN FETCH. Here you will learn how @EntityGraph fixes the same N+1 problem without changing the query text, and where it behaves differently from `JOIN FETC5 min readauthorSummaries() issues 1 + N state6 min readGROUP BY. It builds on the Author and Book model from earlier chapters, where a lazy @OneToMany collection causes N+1 selects.5 min readAuthor and Book model from earlier chapters. You have seen JOIN FETCH remove N+1 queries. Fetching a collection with a join brings two problems of its own: pagination and multiple bags. Both come fro5 min readJOIN FETCH, @EntityGraph, batch fetching, and DTO projections. It also assumes you know basic JPQL and Spring Data repositories. Here you learn how to pick one fix for a given 6 min read@Entity, @OneToMany and @ManyToOne mappings from the earlier chapters. You should also know what the persistence context is and why lazy associations load on first access. Here you will see how Ope6 min read@SpringBootTest, JUnit 5, AssertJ).5 min readJOIN FETCH5 min read