[jboss-user] [JBoss jBPM] - getting taskList with process variables non lazy
holly77
do-not-reply at jboss.com
Wed Mar 28 10:03:56 EDT 2007
I got about 1500 taskInstances in my DB applied to a single user.
I'm extracting all these TaskInstances via
jbpmCtx.getTaskList("actorId");
|
Then I'm accessing the contextVariables of the according contextInstance by
Token tk = taskInstance.getToken();
| ProcessInstance pi = tk.getProcessInstance();
| ContextInstance ci = pi.getContextInstance();
| ci.getVariable("nameOfVariable");
|
Problem is, that the ProcessInstance, ContextInstance and Variables are fetched non lazy by Hibernate. Thus for each access to a Set of variables a new query is executed. It takes ca. 50 sec to retrieve all the results i need, wich is much too long!
Currently I'm trying a workaround based upon HQL like this:
List<Object> list =
| s.createQuery("select ti, tk, pi, vi " +
| "from TaskInstance ti " +
| "join ti.token tk " +
| "join tk.processInstance pi, " +
| "VariableInstance vi " +
| "where vi.token=tk").
| list();
This is rather ugly...
Does anyone know, or can anyone think of another, better way to initialize the Variables of the according ContextInstance of a TaskInstance.?
By the way...
Shouldn't the global variables of a Token be passed through to the local variables of a TaskInstance? Currently they are not... Is this a bug?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032330#4032330
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032330
More information about the jboss-user
mailing list