I am trying to implement optimistic locking using JPA. I read that adding one additional field, version with @Version annotation can used to apply implicit optimistic locking. After implementing, I will be able to prevent lost updates in case of multiple users trying to update the same entity.If any update is made and if version field do not match with the version field of entity, meaning entity was updated meanwhile by other user, then no row is updated, thereby preventing lost update.
I am using Spring Transaction management support where for updating entity, all I have to is update the Entity fields and database update is taken care by Spring transaction manager, meaning I need not call update query explicitly.
My Question is that, How would I be able to know if update made for a particular user was successful?