Skip to content
Ameen Abozaid
Planned lessonJNR-031-L07

Demo: making checkout atomic

  • Lesson 7 of 8
  • 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

make "place order" all-or-nothing; prepares JNR-031-LAB1.

Draft outline details

Step by step

  1. Show placeOrder without @Transactional: stock is reserved, then the order save fails; stock is wrong.
  2. Add @Transactional to the service method.
  3. Re-run the failing test: stock is unchanged.
  4. Planned mistake: throw a checked exception and show the stock change committed; fix with rollbackFor.
  5. Add @Transactional(readOnly = true) to the order query method.

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.

Continue to next lesson

Type to search levels, phases, modules and lessons.