I have a list of groups and next to each row, there is a link named edit. When I click on edit, I go to a page where the information of the selected group are filled, and in that page there is a button update. If I modify the information of the group then click on update, the selected group is updated perfectly and with no errors but if I don't update the information and click on update, the next time I click on the edit link of that group in the listing page, I got an exception on the Jboss server which is the following:
Caused by: javax.ejb.EJBTransactionRolledbackException: javax.persistence.OptimisticLockException: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction
Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)
Please guys, I need your help because I am stuck! How can I solve this knowing that no other transaction is taking place at the same time?
You need to refresh the list after changing the data in it. Otherwise Hibernate will detect an optimistic lock failure.