the problem I see here is, that someone can set an explicit fetch on the criteria
Code:
criteria.setFetchMode()
your logic would not detect this - and it seems very difficult to get this information from the criteria that you have, because there is no way to directly access the fetchModes-map from CriteriaImpl
so what you could do about this:
* use reflection to access the private member
* iterate over all possible fetch-joins (using the info from the metadata) and find out if any of these exist by calling CriteriaImpl.getFetchMode()