ACID Properties — Atomicity, Consistency, Isolation, Durability
Fast recall
Quick revision
Core answer
Whether the candidate can define all four ACID properties clearly and explain why they matter together as a system for production applications
Confusing Consistency with eventual consistency or data replication, or treating ACID as four independent properties instead of understanding how they work together to guarantee transaction safety
Walk through a bank transfer example showing what breaks if each property is missing, demonstrating that you understand ACID as a cohesive guarantee and can connect it to real-world failure modes
Interview-ready guide
Interview answer
ACID describes four properties of a transaction. Atomicity means all its changes commit or none do. Consistency means successful work preserves the rules that the database and application actually enforce. Isolation controls what concurrent transactions can observe, and its exact strength depends on the chosen level. Durability means an acknowledged commit survives a restart within the configured storage guarantees. A bank transfer shows the difference: debit and credit share one atomic transaction, a balance rule must be encoded and checked, concurrent transfers need suitable isolation or locking, and the committed result must survive recovery. In Spring, @Transactional declares the boundary, but the database engine, constraints, isolation, rollback rules, and durability settings provide the real guarantees.
ACID Properties — Atomicity, Consistency, Isolation, Durability
Direct Answer
ACID describes four transaction properties: Atomicity means all of a transaction commits or none does; Consistency means a successful transaction preserves the rules the database and application enforce; Isolation controls what concurrent transactions can observe; and Durability means a successful commit survives a restart within the configured storage guarantees.
Code Example
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
@Service
public class BankTransferService {
private final AccountRepository accountRepo;
public BankTransferService(AccountRepository accountRepo) {
this.accountRepo = accountRepo;
}
@Transactional
public void transfer(Long fromId, Long toId, BigDecimal amount) {
var from = accountRepo.findByIdForUpdate(fromId).orElseThrow();
var to = accountRepo.findByIdForUpdate(toId).orElseThrow();
from.debit(amount);
to.credit(amount);
// Both managed changes share one transaction. The explicit locking
// policy addresses concurrent transfers; @Transactional alone does not.
}
}
Common Mistakes & Pitfalls
- Confusing two meanings of consistency: ACID consistency is about preserving invariants; replica consistency is about what copies of data return.
- Treating isolation as serial execution: Weaker isolation levels intentionally allow some observations, so choose the level and concurrency control from the business rule.
- Treating
@Transactionalas magic: It declares a boundary. It does not add missing constraints, make remote calls atomic, or override the database's configured durability.
Check your understanding
Answer these without looking back at the article.
- What is the difference between Atomicity and Durability?
- How does Isolation prevent data anomalies?
- Is MySQL InnoDB ACID compliant?
Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.