[jboss-user] [jBPM] - Re: Removing history information of completed process instances

Michael Wohlfart do-not-reply at jboss.com
Thu Oct 28 06:44:48 EDT 2010


Michael Wohlfart [http://community.jboss.org/people/mwohlf] created the discussion

"Re: Removing history information of completed process instances"

To view the discussion, visit: http://community.jboss.org/message/568808#568808

--------------------------------------------------------------
in jbpm4 the DbSessionImpl has a deleteProcessDefinitionHistory() method, you can use that as base for whatever history information you want to delete:

   List<HistoryProcessInstanceImpl> historyProcessInstances = session
            .createCriteria(HistoryProcessInstanceImpl.class)
            .add(Restrictions.eq("processDefinitionId", processDefinitionId))
            .add(... insert random other Restriction here ...)
            .list();
    // you also have to delete the activity since they have a foreign key relationship
    for (HistoryProcessInstanceImpl hpi : historyProcessInstances) {
      List<HistoryActivityInstanceImpl> historyActivityInstances = session
              .createCriteria(HistoryActivityInstanceImpl.class)
              .add(Restrictions.eq("historyProcessInstance", hpi))
              .list();
      for (HistoryActivityInstanceImpl hai : historyActivityInstances) {
        session.delete(hai);
      }
      session.delete(hpi);
    }
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/568808#568808]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101028/634b0c88/attachment.html 


More information about the jboss-user mailing list