beginnerProjections, Pagination & Sorting

Why would you use an interface-based projection instead of returning full entities from a repository method?

A projection selects only the specific fields you actually need, skipping full entity hydration (and any lazy associations) entirely — for a list/display view that only shows a few fields, this avoids loading and constructing data the caller never uses.

This is a Pro chapter

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

Why would you use an interface-based projection instead of returning full entities from a repository method?

Next Step

Continue to What are the three JPA inheritance mapping strategies, and what's the core tradeoff between them?← Back to all Spring Data JPA & Hibernate Mastery questions