Composite query tables in Business Process Choreographer do not have a specific representation of data in the database; they comprise of a combination of data from related predefined and supplemental query tables. Use a composite query table to retrieve the information for a process instance list or task list, such as My To Dos.
Composite query tables are designed by client developers and they allow for a fine-grained configuration of filters and authorization options for optimized data access when the query is run. They are realized with SQL, which is optimized for task and process list queries.
It is recommended that you use composite query tables in production scenarios in place of the standard Business Process Choreographer query APIs, because composite query tables provide an abstraction over the actual implementation of the query and thus enable query optimizations.
Furthermore, you can change composite query tables at run time without redeploying the client that accesses the query table.

All composite query tables are defined with one primary query table and zero or more attached query tables.
The attached query table and the primary query table must have a one-to-one or one-to-zero relationship. If the one-to-one or one-to-zero relationship is violated, a runtime exception occurs when the query is run.
Primary query tables and attached query tables are correlated using a join attribute that is defined on the attached query table. This join attribute cannot be changed for predefined query tables, because it describes the relationship between the data in the various query tables of Business Process Choreographer. The join attribute is usually sufficient to maintain the one-to-one or one-to-zero relationship. For example, the CONTAINMENT_CTX_ID attribute is used on the TASK query table to attach the related process instance information that is identified by the PIID attribute on the PROCESS_INSTANCE query table.
When a one-to-many relationship exists, you must specify an additional criterion, known as selection criterion, in the Query Table Builder when you define the query table. For example, this could be “LOCALE='en_US'”. A task can have several descriptions that are identified using different locales for a single task. To further restrict the items that are returned by the query, you can attach a supplemental query table with selection criteria to the composite query table, and enable the optimizeForFiltering option.
Example 1:

Example 2:
| TASK primary query table information | TASK_DESC attached query table information | |
|---|---|---|
| NAME | LOCALE | DESCRIPTION |
| task_one | en_US | This is a description. |
| task_two | en_US | This is a description. |
| ... | ... | ... |
| Information from TASK (primary query table) | Information from TASK_DESC (attached query table) | |
|---|---|---|
| NAME | LOCALE | DESCRIPTION |
| task_one | en_US | This is a description. |
| task_one | de_DE | Das ist eine Beschreibung. |
| ... | ... | ... |
Composite query tables have the following properties:
| Property | Description |
|---|---|
| Name | The query table name must be unique within a
Business Process Choreographer installation. When the query is run,
this query table name is used to identify the query table that is
queried. A query table is uniquely identified using its name, which is defined as prefix.name for composite query tables. The maximum length of the prefix.name is 28 characters. The prefix must be different from the reserved prefix ‘IBM', for example, 'COMPANY.TODO_TASK_LIST'. Do not use a digit at the end of the table name. If a table is used multiple times within a query, the name of the table is extended with a number ranging from 0 to 9. For example, CUSTOM_VIEW0, CUSTOM_VIEW1 and so on. If there is already a digit at the end of your table name, Business Process Choreographer will remove this digit, which causes an QueryUnknownTableException. |
| Attributes | Attributes of composite query tables define
the pieces of information that are available for queries. The attributes are defined with a name, in uppercase. The type is inherited from the referenced attribute, which is one of the following:
Attributes of composite query tables are defined using a reference to attributes of the primary query table or the attached query tables. The attributes of the composite query tables inherit the types and constants of referenced attributes. In addition to the attributes that are part of the query table definition, work item information can be queried at run time. This is possible if the primary query table contains instance data, such as TASK or PROCESS_INSTANCE, and if instance-based authorization is used on the composite query table. For example, the query can be defined to return only human tasks of which the user is a potential owner. |
| Authorization | Each composite query table defines if instance-based,
role-based, or no authorization is used when queries are run on it. If instance-based authorization is defined, only objects with a work item for the user who performs the query are returned. However, using AdminAuthorizationOptions this verification can be reduced to a verification of the existence of a work item of any user. The user must be in the BPESystemAdministrator Java EE role if the Business Flow Manager EJB is used or the TaskSystemAdministrator Java EE role if the Human Task Manager EJB is used, for those queries, and AdminAuthorizationOptions must be passed to the query table API. If role-based authorization is defined, the user must be in the BPESystemAdministrator Java EE role if the Business Flow Manager EJB is used or the TaskSystemAdministrator Java EE role if the Human Task Manager EJB is used, for those queries, and AdminAuthorizationOptions must be passed to the query table API. If you use the WorkBasketSystemAdministrator Java EE role for the Human Task Manager EJB, the AdminAuthorizationOptions object can also be used for the WORK_BASKET query table. Similarly, if you use the BusinessCategorySystemAdministrator Java EE role, the AdminAuthorizationOptions object can be used for the BUSINESS_CATEGORY query tables. If no authorization is defined, the query is run without checks against the existence of work items of the related objects in the query table. All authenticated users can see the contents of the query table. Instance-based authorization can be defined if the primary query table contains instance data; role-based authorization can be defined if the primary query table contains template data. No authorization can be defined on composite query tables regardless of which primary query table is used. |

Filters are defined during query table development. For example, a composite query table with the TASK primary query table can filter on tasks that are in the ready state (“STATE=STATE_READY” as the primary query table filter).