[jboss-user] [JBoss jBPM] - process variables out of session
frantisek.kocun@gmail.com
do-not-reply at jboss.com
Tue Aug 5 04:55:22 EDT 2008
Hi, I use variables (business objects) in ActionHandler
public class Task_ABC implements ActionHandler{
public void execute(ExecutionContext executionContext) throws Exception {
ContextInstance c = executionContext.getProcessInstance().getContextInstance();
Abc abc= (Abc) c.getVariable("abc");
.... do something ...
executionContext.leaveNode();
}
}
Problem is that this variables are not registered in session, if variable has an association and I use it, I get an exception. But if I have variable class has only primitive attributes (String, BigDecimal..) it works perfectly. Workaround is to declare all association in Hibernate as lazy="false" what I don't want. But really interesting is, that if I change value in variable that it will be stored in db. That means that jbpm will register variables in Hibernate session but later and I don't know when.
I don't use any special workflow configuration. This is snip set from my workflow interface:
public class WorkflowService extends HibernateDaoSupport implements IWorkflowService {
private static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
public void startWorkflow(Workflow workflow, Map<String, Object> variables) {
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
jbpmContext.setSessionFactory(getSessionFactory());
jbpmContext.setSession(getSession());
try {
ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate(workflow.getFullName());
processInstance.getContextInstance().setTransientVariables(variables);
processInstance.signal();
} finally {
jbpmContext.close();
}
}
Thanks
Fero
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4168667#4168667
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4168667
More information about the jboss-user
mailing list