advancedDistributed Transactions: Why 2PC Fails at Scale

Why can't @Transactional alone keep two different services' databases consistent?

@Transactional guarantees atomicity within ONE database connection — it has no mechanism for guaranteeing that a write in one service's database and a write in a completely separate service's database either both happen or neither does.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to Why does 2PC rarely survive contact with real production microservices despite being theoretically correct?← Back to all Spring Cloud questions