0 Replies Latest reply on Jul 7, 2007 10:23 AM by gena777

    Correct recovery with optlock and extended PC

    gena777

      Hello all,

      some entity was changed otherwise during it was editing in web. This entity is associated with an extended persistent context. After trying to persist the changes, it naturally (as expected) throws an exception. My idea is

      Entity merged = em.merge(dirtyEntity) ;
      if(merged.isModifiable())
       em.persist(merged);
      


      quite simple, but the merge returns an entity with old version number (doesn't hit the DB). So this simple case doesn't work.

      What is the best way to recover from the optimistic lock exception/issue?

      Thank you for advise, Gena