[jboss-user] [JBoss jBPM] - How to save process instance into database?
slacker27
do-not-reply at jboss.com
Thu Nov 2 05:31:05 EST 2006
the next is my code :
private void execute() throws Exception {
JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
GraphSession graphSession = jbpmContext.getGraphSession();
TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession();
long processDefinitionId = 1;
org.jbpm.graph.def.ProcessDefinition processDefinition = graphSession.loadProcessDefinition(processDefinitionId);
ProcessInstance processInstance = new ProcessInstance(processDefinition);
org.jbpm.taskmgmt.exe.TaskInstance taskInstance = processInstance.getTaskMgmtInstance().createStartTaskInstance();
processInstance.signal();
jbpmContext.save(processInstance);
System.out.println(jbpmContext.getSession().isOpen());
Token token = processInstance.getRootToken();
System.out.println("LAST NODE:" + token.getNode().getName());
}
after i execute it, i found the process instance data has not been saved in db(mysql),
And I know if i call "jbpmContext.close()" explicitly, it was saved.
Has there any other ways to do that?
(for example: by modifing the configuration file and do not midifing the code)
And when i config my :jbpm.cfg.xml" followed the direction in chapter 7 in the user's guide like this:
exception thrown:
Exception in thread "main" org.jbpm.JbpmException: couldn't parse jbpm configuration from resource 'jbpm.cfg.xml'
at org.jbpm.JbpmConfiguration.getInstance(JbpmConfiguration.java:284)
at org.jbpm.JbpmConfiguration.getInstance(JbpmConfiguration.java:256)
at Test.execute(Test.java:30)
at Test.main(Test.java:23)
Why?
Thanks!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982613#3982613
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982613
More information about the jboss-user
mailing list