Demo: rewriting the sales report with jOOQ
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
- Show the report as plain SQL from MID-011 (CTE and window function).
- Add the jOOQ Gradle/Maven plugin; generate classes from the Flyway-migrated database.
- Rewrite the query using
DSL.with(...),DSL.rank().over(...), and fetch into a record. - Planned mistake: change a column name in a migration without regenerating classes; show the build failing, then regenerate. Explain this is the safety net.
- 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.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.