intermediateRelationships & Queries

Why does Hibernate default `@OneToMany` to `FetchType.LAZY` but `@ManyToOne` to `FetchType.EAGER`?

A `@ManyToOne` points to a single row, so eagerly loading it is cheap and usually needed anyway (e.g. an Order almost always needs its Customer). A `@OneToMany` can point to an unbounded collection, so eagerly loading it by default could silently pull thousands of rows for every parent fetched — Hibernate defaults it to lazy so you opt in explicitly when you actually need the collection.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to How do Spring Data JPA's derived query methods like `findByEmailAndStatus` actually work?← Back to all Spring Boot questions