IBM BPM, V8.0.1, All platforms > Programming IBM BPM > Developing client applications for BPEL processes and tasks > Queries on BPEL process and task data > Business Process Choreographer EJB query API > Examples of the query and queryAll methods

Example: Querying escalations

This example shows how to use the query method to retrieve escalations for the logged-on user.

When a task is escalated, and escalation receiver work item is created. The user, Mary Jones wants to see a list of tasks that have been escalated to her. The following code snippet shows the query method call for the query:

query( "DISTINCT ESCALATION.ESIID, ESCALATION.TKIID", 
         "WORK_ITEM.REASON = WORK_ITEM.REASON.REASON_ESCALATION_RECEIVER",  
           (String)null, (String)null, (Integer)null, (TimeZone)null )

The following actions are taken when the SQL SELECT statement is generated:

The following code snippet shows the SQL statement that is generated from the API query:

 SELECT DISTINCT ESCALATION.ESIID, ESCALATION.TKIID
   FROM   ESCALATION ESC, WORK_ITEM WI 
   WHERE  ESC.ESIID = WI.OBJECT_ID
   AND    WI.REASON  = 10                                 
   AND  
  ( WI.OWNER_ID = 'MaryJones' OR WI.OWNER_ID = null AND  WI.EVERYBODY = true )
    
 

Examples of the query and queryAll methods