|
Implementation idea: I'm not terribly familiar with the Hibernate codebase, but since I've spent a while debugging through the code to track down this issue, here are my notes in case they're useful in designing a fix. If I have time later, I may try to test it out and submit a patch, but I have to table my investigation for now. My apologies if this is all obvious to the Hibernate team, or if I'm completely off-base.
The problem is that the Loader for the eager-fetched entity calls endCollectionLoad too early. It is called when the eager-fetched entity is done being loaded, but the top-level entity may not be finished loading entities yet. It seems as though the call to endCollectionLoad for the eager-fetched entity needs to be deferred until the top-level loader exits the loop that calls TwoPhaseLoad.initializeEntity for all the hydrated objects. I guess the tricky part might be that the top-level entity doesn't have direct access to the loaders for all the hydrated child objects.
|