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: Using the queryAll method

This example shows how to use the queryAll method to retrieve all of the activities that belong to a process template.

The queryAll method is available only to users with system administrator or system monitor rights. The following code snippet shows the queryAll method call for the query to retrieve all of the activities that belong to the process template, sampleProcess:

queryAll( "DISTINCT ACTIVITY.AIID", 
       "PROCESS_TEMPLATE.NAME = 'sampleProcess'",  
       (String)null, (String)null, (Integer)null, (TimeZone)null )

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

 SELECT DISTINCT ACTIVITY.AIID
   FROM   ACTIVITY AI, PROCESS_TEMPLATE PT
   WHERE  AI.PTID = PT.PTID
   AND    PT.NAME = 'sampleProcess'  
 
Because the call is invoked by an administrator, an access control condition is not added to the generated SQL statement. A join with the WORK_ITEM view is also not added. This means that the query retrieves all of the activities for the process template, including those activities without work items.

Examples of the query and queryAll methods