[jboss-user] [JBoss jBPM] - Saving TaksInstance, Task == NULL

jstachera do-not-reply at jboss.com
Wed Dec 13 06:37:38 EST 2006


I have a problem with saving task instance. 

First I create the process instance and then I save it.

ProcessDefinition processDefinition = context.getGraphSession().findLatestProcessDefinition(pName);
  | org.jbpm.graph.exe.ProcessInstance processInstance =  new ProcessInstance(processDefinition);
  | context.save(processInstance);

In next step I retrieve the process instance and create the start task. It takes place in different method with new context.

public static long createStartTaskInstance(int processInstanceId, JbpmDefSession session) throws Exception {
  | 		JbpmContext context = session.getContext();
  | 		try {
  | 			ProcessInstance processInstance = context.getProcessInstance(processInstanceId);
  | 			TaskInstance taskInstance = processInstance.getTaskMgmtInstance().createStartTaskInstance();
  | 			context.save(taskInstance);
  | 			return taskInstance.getId();
  | 		}
  | 		catch (Exception e) {
  | 			log.error(e);
  | 		}
  | 		finally {
  | 			context.close();
  | 		}
  | 	}
  | 

After creating the start task instance I checked the JBPM_TASKINSTANCE table for this task. I found that the task data does not have a reference to task (task_ column is empty) as well as it has empty name_ column, the rest is ok. Because of that it is not possible to get the Task definition from the task instance:

taskInstance.getTask()

returns null.

Where is the problem ?? Or maybe it can not be done in this way ??

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

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



More information about the jboss-user mailing list