JPA Persistence Context and Dirty Checking

A managed entity from findById gets UPDATEd through dirty checking, with no save() call. The three entity states, how snapshot comparison works, what save() actually does, and the persistence context lifetime that all of it depends on.

July 6, 2026 · 4 min read

Optimistic and Pessimistic Locking

A transaction gives atomicity, a lock gives serialization — they aren’t substitutes. How pessimistic and optimistic locking cover the Lost Update that an isolation level’s plain reads don’t, and how to choose between them.

October 1, 2023 · 6 min read