posted 14 years ago
I'm using JPA with hibernate as the provider. I've implemented an entity with a self referencing relationship in order to be
able to do nested categories. When I load the root node, hibernate generates one select for each entity in the tree in order
to load the children. Im beginning to think, by the very nature of this type of tree, that this is unavoidable. can someone confirm?
Here's the mapping:
and here's the query. I just query the root node. Maybe this part is wrong
Here's the data:
and here's what hibernate does.
Too many selects (1 per entity to load all the children)
So, am I doing something wrong?