Explaining the example I've posted.
The main entity you are fetching is the Customer Entity.
That's why the first prefetchPath must starts from the CustomerEntity.
CustomerEntity.PrefetchPathOrders
And since it's there to prefetch Orders, the expected type for this PathEdge is the OrderEntity.
This should explain this part:
new PathEdge<OrderEntity>(
CustomerEntity.PrefetchPathOrders
Similarly since this pathEdge is fetching Orders, if you need to sub-Prefetch another entities, you should strat from the OrderEntity.
This explains the list of SubPaths used with the OrderEntity
new PathEdge<OrderDetailsEntity>(OrderEntity.PrefetchPathOrderDetails),
new PathEdge<EmployeeEntity>(OrderEntity.PrefetchPathEmployee)));
So in short the above code was fetching Customers, and prefetching the Orders.
And Sub-Prefetching OrderDetails and the Employees of the Orders.