-
1. Re: not able to save processInstance
forjbpm Apr 4, 2006 5:19 PM (in response to forjbpm)ooops!
My Question was
If this is not right method then how should I save my processInstance.
In my code (for which output is given)Token token = processInstance.getRootToken(); System.out.println("token is"+token); token.signal(); System.out.println("token.signal() is done");
is commented.
Please help! -
2. Re: not able to save processInstance
qweniden Apr 4, 2006 6:41 PM (in response to forjbpm)the "save()" method on the JbpmContext class accepts an instance to be saved.
-
3. Re: not able to save processInstance
forjbpm Apr 5, 2006 9:45 AM (in response to forjbpm)Do you think taht instead of using jbpmSession and JbpmSessionFactory, I should use JbpmConfiguration and jbpmContext?
Please suggest.
Whats the plan! -
4. Re: not able to save processInstance
forjbpm Apr 5, 2006 10:19 AM (in response to forjbpm)ok!
One more thing!
I followed qweniden's suggestion. and changed my method topublic long uploadDocument(String processDefinitionName) { long processInstanceId = 0; JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); System.out.println("jbpmContext is:"+jbpmContext); ProcessDefinition processDefinition = jbpmContext.getGraphSession().findLatestProcessDefinition(processDefinitionName); try { ProcessInstance processInstance = new ProcessInstance(processDefinition); System.out.print("processInstance is "+processInstance); Token token = processInstance.getRootToken(); System.out.println("now saving GraphSession"); GraphSession graphSession = jbpmContext.getGraphSession(); System.out.println("graphSession is "+graphSession); //saving jbpmContext jbpmContext.save(processInstance); System.out.println("saved process instance processInstance is"+processInstance); processInstanceId = processInstance.getId(); System.out.println("processInstanceId is : "+processInstanceId); } catch (Exception ex) { System.out.println("In catch method "); } return processInstanceId; }
output for this is as expected10:04:16,652 INFO [STDOUT] jbpmContext is:org.jbpm.JbpmContext@4845f3 10:04:16,785 INFO [STDOUT] processInstance is org.jbpm.graph.exe.ProcessInstance@19c03e7 10:04:16,785 INFO [STDOUT] now saving GraphSession 10:04:16,785 INFO [STDOUT] graphSession is org.jbpm.db.GraphSession@179e567 10:04:16,788 INFO [STDOUT] saved process instance processInstance isorg.jbpm.graph.exe.ProcessInstance@19c03e7 10:04:16,788 INFO [STDOUT] processInstanceId is : 478
but when I look in my database there is no entry in jbpm_processinstance for id_ =478 -
5. Re: not able to save processInstance
forjbpm Apr 5, 2006 10:30 AM (in response to forjbpm)huh!
Okay! I found out that
i have to save jbpmContext (jbpmContext.save()) before returning processInstanceID and then it saves the processInstance.
Still I would like to ask,
Should I use jbpmSessionFactory and jbpmSession at all?
and as JbpmConfiguration is static can I use it in my ejbcreate() and use it? ( I mean thats the way I am doing it now)
Thanks and regards, -
6. Re: not able to save processInstance
forjbpm Apr 5, 2006 10:31 AM (in response to forjbpm)oops! its jbpmContext.close() not jbpmContext.save()
-
7. Re: not able to save processInstance
koen.aers Apr 10, 2006 7:45 AM (in response to forjbpm)You should use JbpmContext instead of JbpmSessionFactory and JbpmSession, which are deprecated. And yes, you can use JbpmConfiguration in your ejbCreate.
Regards,
Koen