0 Replies Latest reply on Feb 13, 2009 11:17 AM by John Lennon

    Updating seam entity causing: "Another user changed the same data, please try again"

    John Lennon Newbie


      I've problem executing this piece of code in Stateful seam component:

      // create new entity object
      Car myCar = new Car();
      // save entity for a first time - entity is save correctly in database
      log.debug("Saving car: " + myCar);
      // update entity member parameter
      log.debug("Changing car type to: " + myCar);
      // flush manager - maybe not needed ?
      log.debug("Flushing manager");
      // saving updated entity - this one is causing exception: "Another user changed the same data, please try again"
      log.debug("Saving changed car : " + myCar);

      As result in log file I can find error mesage:

      org.hibernate.event.def.AbstractFlushingEventListener: Could not synchronize database state with session

      and in the bowser this message appears:

      Another user changed the same data, please try again

      My question is:
      Entity is created in database but updated causes exception - how to perform this action ?