also close the context
Actually I am closing the context, here is the full code :
JbpmContext jbpmContext = s_jbpmConfiguration.createJbpmContext();
ProcessDefinition definition = jbpmContext.getGraphSession().getProcessDefinition(Long.parseLong(instanceTO.getTemplateId()));
ProcessInstance instance = new ProcessInstance(definition);
ContextInstance contextInstance = (ContextInstance)instance.getInstance(ContextInstance.class);
catch (Exception e)
throw new WorkflowEngineException(e.getMessage(), e);
Also when I look in the ProcessInstance object during runtime, there are instances and transientInstances, however instances remains null, while transient instance contains my ContextInstance and LoggingInstance. As I add variables, they are being added to my transient instance. Is that correct ? That seems like the reason they are not being persisted but I dont know why its happening.
Thanks for all your help
Well it seems like when I create the process definition by parsing the xml definition everything works fine.
What I was trying to do was programmatically create my process definition. By creating a new process definition object and adding nodes and transitions to it.
Note that in both scenarios the resulting instances are identical except for the fact that in one case the instance variables a transient and thus not saved.
Any thoughts on why this might be happening ? There arent any examples on creating a ProcessDefinition programmatically.