From: Gavin_King/Cirrus%<CI...@ci...> - 2002-08-14 11:58:22
|
Once again, something I had been putting off for a long time turned out to be much easier than expected. I spent the last two days refactoring the fetching code + its now not only much more powerful but also more understandable. * one-to-many associations always fetched in a single select (rather than two) * many-to-many collections fetched in a single select when outerjoin fetching enabled * outerjoin fetching enabled upon collection elements (!!!) * outerjoin fetching enabled for associations held by components So, for example, if we have a list containing components which each have a many-to-one to some entity class which in turn has a many-to-one to a class with a component that has a many-to-one, that the whole list and all the associated objects are fetched in a *single* select when outerjoin fetching is enabled. So Hibernate can now fetch an entire graph of objects in exactly n+1 selects where n is the number of collection instances in the graph. The only thing missing from this picture is that outerjoin fetching is still not enabled for the first level of a find() query. This will be quite easy to implement given the machinery I've now built. I'm feeling pretty proud of myself now..... ;) |