advancedRelationships — @OneToMany, @ManyToOne, @ManyToMany, Cascade & FetchType

What is JPA's actual default FetchType for @ManyToOne and @OneToOne, and why does that surprise people?

EAGER — unlike @OneToMany and @ManyToMany, which default to LAZY. This is a common, genuine gotcha: developers who assume every association defaults to lazy loading are surprised to find @ManyToOne/@OneToOne associations loading eagerly on every parent fetch unless explicitly overridden to LAZY.

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full Spring Ecosystem Mastery library.

What is JPA's actual default FetchType for @ManyToOne and @OneToOne, and why does that surprise people?

Next Step

Continue to What is the self-invocation trap with @Transactional, and why does it happen?← Back to all Spring Data JPA & Hibernate Mastery questions