I have a patch for drools-persistence-jpa should anyone agree with me that ProcessInstanceInfo and VariableInstanceInfo should be joined by processInstanceId.

On Fri, Feb 12, 2010 at 10:52 AM, Dale Wyttenbach <dale.wyttenbach@gmail.com> wrote:
I'm trying to adapt the StringVariablePersister presented in http://blog.athico.com/2009/09/drools-flow-variable-persistence.html

I can create process instances with variable "color":

  private static WorkflowProcessInstance startProcess(StatefulKnowledgeSession ksession, String color) {
    Map<String, Object> vars = new HashMap<String, Object>();
    vars.put("color", color);
    WorkflowProcessInstance p1 = (WorkflowProcessInstance) ksession.startProcess("com.sample.ruleflow", vars);
    return p1;
  }

I can count them:

select 
    count(*)
from 
    ProcessInstanceInfo

However I'm stymied as to counting process instances with a given color, as there appears to be no join column between ProcessInstanceInfo and VariableInstanceInfo.
Can such a query be written?

Thanks.