| Hello!
 When I abstract from Hibernate using the DAO Pattern, how can I avoid a lost update? For example I execute the following steps:
 
 1. I call a "read" DAO method, which uses Hibernate to load the data I need from the database and gives me back a DTO.
 2. I do something with this data and modify it.
 3. I write it back by calling an "update" DAO method, which again uses Hibernate to make the changes persistent.
 
 If I have two users, which execute these steps in parallel, I could end up with a lost update. One solution would be to implement my own optimistic locking, but isn't there a better way where I can use the optimistic locking of Hibernate? Or a different pattern?
 
 Thank you very much for any suggestions or links,
 Jonas
 
 P.S.: I posted a similar question on theserverside, but I thought maybe someone here had the same problem.
 
 
 |