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.

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 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