2 Replies Latest reply on Jul 2, 2009 6:14 PM by Ronald van Kuijk

    Query tasks by process context

    shahzad bhatti Newbie

      I am using JBPM 3.3 and would like to query TaskInstance(s) by the process context of the workflow. I am using Spring 2.5 based HibernateTemplate. I would like to do something like:

      List tasks = getHibernateTemplate().findByNamedParam("from " + TaskInstance.class.getCanonicalName() where variable.name = :name and variable.value =:value", paramNames, values);

      All of my context values are simple strings, can someone suggest a way to do this?

        • 1. Re: Query tasks by process context
          shahzad bhatti Newbie

          I got it sort of working using following HQL:
          select ti from org.jbpm.taskmgmt.exe.TaskInstance ti , org.jbpm.context.exe.variableinstance.StringInstance si WHERE ( ( ti.processInstance.id = si.processInstance.id AND si.name = :_name_number1 AND si.value = :_value_number1 ) OR ( ti.processInstance.id = si.processInstance.id AND si.name = :_name_assignedTo AND si.value = :_value_assignedTo ) ) with args {_value_number1=1, _name_number1=number1, _name_assignedTo=assignedTo, _value_assignedTo=user0}

          But I am not sure if there is a better way to do this?

          • 2. Re: Query tasks by process context
            Ronald van Kuijk Master

            no, there is not. This is one of the usecases that is not easily supported AND performant for all cases.

            If it is a 'special' variable, you might consider using it as a businesskey.