Skip to content
Ameen Abozaid
Planned lessonMID-022-L05

Demo: rewriting the sales report with jOOQ

  • Lesson 5 of 5
  • Mid-level
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

port the SQL sales report to jOOQ and compare approaches.

Draft outline details

Step by step

  1. Show the report as plain SQL from MID-011 (CTE and window function).
  2. Add the jOOQ Gradle/Maven plugin; generate classes from the Flyway-migrated database.
  3. Rewrite the query using DSL.with(...), DSL.rank().over(...), and fetch into a record.
  4. Planned mistake: change a column name in a migration without regenerating classes; show the build failing, then regenerate. Explain this is the safety net.
  5. Compare results with the original query and note readability and refactor safety.

Prepares MID-022-LAB1.

Check your understanding

What happens to the jOOQ code when a column is renamed and classes regenerated?

Show answer

The compiler flags every use of the old column.

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.