[jbpm-users] [JBoss jBPM] - Error Saving ProcessInstance using AssignmentHandler

johnhurtchan do-not-reply at jboss.com
Fri Nov 21 15:03:27 EST 2008


Hi,
My code does a token.signal(). Then saves does a successful JbpmContext.save(ProcessInstance).

But, when I add a AssignmentHandler for a Task in the Next Node, where I try to set the ActorID, I get a hibernate exception below...

object references an unsaved transient instance - save the transient instance before flushing: org.jbpm.graph.exe.Token

My code looks like this...

public class AssignmentHandler extends BaseHandler implements AssignmentHandler
  | {
  |   public void assign(Assignable assignable, ExecutionContext executionContext)
  |   {
  |     ContextInstance contextInstance = (ContextInstance)(executionContext.getProcessInstance()).getContextInstance();
  |     TaskInstance task = executionContext.getTaskInstance();
  |     task.setActorId(123);
  |   }
  | }

What do I need to do to fix it?  I tried to modify that code above to try to save the TaskInstance that I modified the ActorID, but still get the same error...

public class AssignmentHandler extends BaseHandler implements AssignmentHandler
  | {
  |   public void assign(Assignable assignable, ExecutionContext executionContext)
  |   {
  |     ContextInstance contextInstance = (ContextInstance)(executionContext.getProcessInstance()).getContextInstance();
  |     TaskInstance task = executionContext.getTaskInstance();
  |     JbpmContext jbpmContext = Config.jbpmConfiguration.createJbpmContext();
  |     TaskInstance myTask = jbpmContext.getTaskInstanceForUpdate(task.getId());
  |     myTask.setActorId(user.getName());
  |     jbpmContext.save(myTask);
  |     jbpmContext.close();
  |   }
  | }

Help!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4191404#4191404

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4191404



More information about the jbpm-users mailing list