Skip to main content
InterviewHubPRO
Section Overview
Q22

Question 22 of 50

Part 2: Persistence, Transactions & Security (11 - 24)

44%
Spring Boot & Microservices (50 Qs)•Part 2: Persistence, Transactions & Security (11 - 24)

What is Dirty Checking in Hibernate?

junior LevelState ManagementSecurity & AuthDatabases & SQL

In Simple Words: When an entity is loaded inside an @Transactional method, Hibernate stores a snapshot of its state in the L1 cache. When the transaction commits, Hibernate compares the entity's current state with the initial snapshot. If any fields changed, Hibernate automatically generates and executes the SQL UPDATE statement. You do NOT need to call repository.save().