0 Replies Latest reply on Aug 22, 2006 3:01 PM by treespace

    Version is not updated

    treespace Novice

      Merge an entity whose @Value column is 100 and the database shows 101 as expected. Unfortunately the entity returned by em.merge still has value 100. Moreover, calling em.refresh returns an enitity whose value is still 100 even though the database clearly has 101. Consequently, trying to re-save that entity generates the following:

      javax.persistence.OptimisticLockException: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction

      I am using MySQL 5.1 and JBoss 4.0.4 GA

      WORKAROUND: after saving the entity I query the entity manager and in that case the entity @Version column comes back with the incremented value.