.deleteCommentsByProcessInstanceId(historicProcessInstanceId);
getDbSqlSession().delete(historicProcessInstance);
// Also delete any sub-processes that may be active (ACT-821)
HistoricProcessInstanceQueryImpl subProcessesQueryImpl = new HistoricProcessInstanceQueryImpl();
subProcessesQueryImpl.superProcessInstanceId(historicProcessInstanceId);
List<HistoricProcessInstance> selectList = getDbSqlSession().selectList("selectHistoricProcessInstancesByQueryCriteria", subProcessesQueryImpl);
for(HistoricProcessInstance child : selectList) {
deleteHistoricProcessInstanceById(child.getId());
}