The query usually implies periodic polling and in many situations parent sending a signal to the child upon reaching a certain state is more efficient.
If you still want to run a query from the parent use an activity. Note that only workflow code is allowed to call static methods on the Workflow
class. An activity code has to use a WorkflowClient
to create the workflow stub.
Nit: There is no need to pass the parentId
to the child. The child can access it through
Workflow.getInfo().getParentWorkflowId()