Process instances and their sub process instances are often connected by a shared BusinessKey. That makes it possible to find all process instances that belong together.
Unfortunately it is not possible (as far as I can see) to use the BusinessKey as a filter criteria in the HistoricTaskInstanceQuery. That makes it unnecessary complicated to request all Tasks that belong to a process instance and its sub process instances. By now you first have to search all process instances with the BusinessKey and than iterate to find the tasks that belong to these process instances.
Did I miss something? Is there some simple solution to get all the tasks of a processInstances including sub process instances?
If not I consider to open a enhancement request.