Hi, first of all I want to say that I checked the forum, but I didn't find anything
to solve my doubt.
Intro:
I'm creating the process definition in a programmatic way. I create the
ProcessDefinition, then the process Instances, and then I create the tasks dinamically. To
create the tasks I have an event "node enter" and createTask = false in the
NodeTask.
This is the ActionHandler I use to create the tasks: (I just put the important code)
| public void execute(ExecutionContext executionContext) throws Exception {
| JbpmContext jbpmContext = JbpmConfiguration.getInstance().createJbpmContext();
|
| TaskMgmtInstance tmi = executionContext.getTaskMgmtInstance();
| TaskNode nodeApproval = (TaskNode)executionContext.getNode();
| //get the only task definited in the processDefinition
| Task task = (Task)nodeApproval.getTasks().iterator().next();
| //taskNumber and user are variables
| //I instantiate for example 3 task
| for (int i=0; i<tasksNumber; i++){
| TaskInstance newTaskInstance= tmi.createTaskInstance(task,
executionContext.getToken());
| newTaskInstance.setActorId(user);
| //THIS IS THE LINE that is not working
| jbpmContext.getSession().save(newTaskInstance);
|
| }
|
I have to put that line because if I don't put, the task instance does not save the
actor. But the problem is that even if I instance three tasks it only saves one.
If I do this, with an xml (not programmatically) work well.
I had to use
jbpmContext.getSession().save(newTaskInstance);
and not jbpmContext.save( ..); because if I use this one on the close it gives me
"object references an unsaved transient instance" exception
any idea, clue?
Thanks
Fernando
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4199878#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...