You can use an HQL query like this:
hql.append("select hpi, hti, ht ");
hql.append("from ");
hql.append(HistoryTaskInstanceImpl.class.getName());
hql.append(" as hti ");
hql.append(" left join hti.historyTask as ht ");
hql.append(" join hti.historyProcessInstance as hpi ");
appendWhereClause(" hpi.state = '" + active + "' ", hql);