2 Replies Latest reply on Jul 6, 2007 11:44 AM by Edward Staub

    StaleObjectStateException after a fork

    André Rieux Newbie

      Hello,

      I'm using a fork to post different tasks to different actors. As a consequence, each of these tasks is related to a different token, and each oh these tokens is a child of the "original" token, the one which entered the fork node.
      When 2 users validate their task at the same time, one of them gets a StaleObjectStateException, which mentions the parent token:

      org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.graph.exe.Token#581]


      Here is a simplified example of my process:
      <process-definition
       xmlns="" name="ForkTest">
       <start-state name="start">
       <transition name="" to="fork1"></transition>
       </start-state>
       <fork name="fork1">
       <transition name="" to="task1"></transition>
       <transition name="tr2" to="task2"></transition>
       </fork>
       <task-node name="task1">
       <!-- ... -->
       <transition name="" to="end1"></transition>
       </task-node>
       <task-node name="task2">
       <!-- ... -->
       <transition name="" to="end2"></transition>
       </task-node>
       <end-state name="end1"></end-state>
       <end-state name="end2"></end-state>
      </process-definition>


      As I understand it, the termination of a Token notifies its parent in order for it to be able to terminate itself if all its children are finished.
      What I can't figure out is why the parent token is modified when one of its children, (which is not the last) comes to an end ? I would have thought that only the termination of the last child token would modify the parent token, so I don't understand why the exception occurs, since there should not be any concurrent omdification of the parent token.

      Any idea ? Is this behaviour normal ? Is there a way to manage this kind of problem without asking the user to re-validate his task ?