Quote:
Criteria API doesn't support setting eager fetching for subcriterias
Sorry, bad example, it doesn't just have to be subcriterias.
When you're
displaying the results of a search, it's quite likely that you're going to need attributes from associated objects, whether you restrict on those associations or not. That's why Criteria API eager fetching functionality exists in the first place, right?
The problem is, if your domain model is fine grained, it's inevitable that you'll need to navigate more than one association deep to get the data to display in the result list of your search.
So, I'm not asking specifically for eager fetching of associations off of subcriterias, I'm asking for eager fetching off of any association.
The example code I gave is severely cut down. The actual subcriteria on entityLocation is optional. If that subcriteria is not added, I still need to eager fetch the entityLocation association (which is easy), but I also still need to eager fetch the entity association off of the EntityLocation objects (seems to be impossible?)