Deleting process instances

Why and when to perform this task

Completed process instances are automatically deleted from the Business Process Choreographer database if the corresponding property is set for the process template in the process model.

You might want to keep process instances in your database, for example, to query data from process instances that are not written to the audit log, or if you want to defer the deletion of processes to off-peak times. However, process instance data that is no longer needed can impact disk space and performance. Therefore, you should regularly delete process instance data. To delete a process instance, you need process administrator rights and the process instance must be a top-level process instance.

The following example shows how to delete all of the finished process instances.

Steps for this task

  1. List the process instances that are finished.
    QueryResultSet result = 
         process.query("DISTINCT PROCESS_INSTANCE.PIID",
                       "PROCESS_INSTANCE.STATE = 
                                PROCESS_INSTANCE.STATE.STATE_FINISHED", 
                        null, null, null);

    This action returns a query result set that lists process instances that are finished.

  2. Delete the process instances that are finished.
    while (result.next() )
    {
    	  PIID piid = (PIID) result.getOID(1);
    	  process.delete(piid);
    }
    This action deletes the selected process instance from the database.
Related concepts
Queries on business-process and task-related objects

Terms of use |

Last updated: Thu Apr 27 14:54:58 2006

(c) Copyright IBM Corporation 2006.
This information center is powered by Eclipse technology (http://www.eclipse.org)