In order to catch an OptimisticLockException inside a EJB method, one has to flush the entitymanager.
try {
em.flush();
}
catch (OptimisticLockException e) {
// do stuff
em.createQuery("select from User").getResultList();
}
when you do that and then in the "catch" block try to reload data from the DB, it does not work because the transaction is closed at this stage.
how can one refresh the internal data in such cases.
Did you found a way to manage what you post here?
Is there anybody can do this in another way?
please give me advices how can I do this stuff.