Skip to content
Ameen Abozaid
Planned lessonJNR-029-L07

Demo: projections for paged listings

  • Lesson 7 of 7
  • Junior
On This Lesson 3 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

build the paged, filtered product list; prepares JNR-029-LAB1.

Draft outline details

Step by step

  1. Define ProductListItem (id, name, price, category name).
  2. Write one @Query with optional name, category, and price-range filters and a Pageable parameter.
  3. Call it from the service with PageRequest.of(page, size, Sort.by("name")).
  4. Planned mistake: return the entity from the controller; show the extra columns and lazy-loading trouble, then switch to the projection.
  5. Check the SQL log: only the listed columns are selected, plus a count query.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Type to search levels, phases, modules and lessons.