|
The idea of the article was to load the flat set of entities that might be involved in a tree and then making use of the fact, that JPA has the concept of a first level cache. The effect is that the parent relations are populated with the appropriate objects making it possible for you to build up the children collection and therefore build up the tree more or less efficiently. Apart from the missing select clause, the query you described seems correct. Using eager load will result in the famous N + 1 select problem as the article kind of mentions. I don't see a bug, it works as intended. Please provide a testcase or some more details if you think this is not the case.
|