<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings version="2.1"
                 xmlns="http://xmlns.jcp.org/xml/ns/persistence/orm"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence/orm http://xmlns.jcp.org/xml/ns/persistence/orm_2_1.xsd">

  <named-query name="ProcessInstancesWaitingForEvent">
    <query>
select 
    processInstanceInfo.processInstanceId
from 
    ProcessInstanceInfo processInstanceInfo join processInstanceInfo.eventTypes eventTypes
where
    eventTypes = :type
    </query>
  </named-query>

  <named-query name="GetProcessInstanceIdByCorrelation">
    <query>
      select
    key.processInstanceId 
from 
    CorrelationKeyInfo key 
where 
    key.name = :ckey
    </query>
  </named-query>
  <named-query name="GetCorrelationKeysByProcessInstanceId">
    <query>
      select
    key 
from 
    CorrelationKeyInfo key 
where 
    key.processInstanceId = :pId
    </query>
  </named-query>
</entity-mappings>
