🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Relationships and Transactions: all 10 questions

Quiz: Relationships and Transactions · Question 9 of 10

Two requests both see "1 seat left" at the same moment. Which is a real fix?

Two requests both see "1 seat left" at the same moment. Which is a real fix?

  1. A.Add more @Transactional annotations
  2. B.Call save() twice
  3. C.Make the method static
  4. D.Use a pessimistic lock, optimistic locking with @Version, or a database constraint
Answer & explanation

Correct answer: Use a pessimistic lock, optimistic locking with @Version, or a database constraint

A Java check alone cannot stop two concurrent transactions from both passing it.

Can you get the rest right without peeking?

Take the timed Quiz: Relationships and Transactions quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →