- when using the repository pattern you deal with entities - those are the atomic units you persist (regardless of Hibernate or "manually")
- when changing an entity you save it as a whole (there's no set or increment field)
- multiple application instances might be running
- the same entity might be fetched/changed/saved concurrently by different application instances
Won't this lead to bad data in the end? Consider the use case of "let me save the amount of password retries in the user entity". Won't that be problematic if an attacker launches many multiple client requests to login? Instance A fetches entity, instance B fetches same entity, instance A changes/saves it, instance B changes/saves the original entity unknowingly of A's change/save.