← 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?
- A.Add more @Transactional annotations
- B.Call save() twice
- C.Make the method static
- 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 →