Hi, for everyone's reference, I modified readLock example of chapter 12 to demonstrate the fact that an optimistic lock can prevent an entity from being updated when it is being read from DB:
When the generateDepartmentSalaryReport method is called, I got this expected error:
Warning: A system exception occurred during an invocation on EJB EmployeeService, method: public examples.model.SalaryReport examples.stateless.EmployeeService.generateDepartmentsSalaryReport(java.util.List)
2017-02-17T21:00:43.818-0500|Warning: javax.ejb.EJBException ...
Caused by: java.util.ConcurrentModificationException