1 Reply Latest reply on Jan 24, 2007 9:49 PM by fernando_jmt

    optimisticlockexception

    balamg

      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.