2 Replies Latest reply on Apr 10, 2008 12:51 PM by gtomassoni

    Hint required: contexts and undo

    gtomassoni

      What is the reference pattern to undo user changes when extended transaction are around (like in Seam) and thereby business objects are never detached?


      When a form in a context changes some fields in a business object (like a db entity, in example), the change takes place immediately and not when a em.persist(...) or em.merge(...) is invoked. I was used to rely on the need for a persist/merge invocation in order to allow undo any change made by user if he/she changed his/her mind right before committing the whole transaction (in example, he/she closes the browser window right before clicking the big are you shure to commit? red button).


      With extended transactions this is not possible because entities are never detached. I could store in the seam context a copy of the original objects and let forms play with them instead of the live entities, but this is going to be quite a pain because I should make a shadow copy of most of the entities I have.


      Is there any simpler pattern to follow for undo?


      Thanks.