I understand the lazy-attribute,
but does hibernate fullfill the following desire on a kind of a fast bulkLoad?
The datastructure is the same as you know it from folders (and files) for example in the windows-explorer. So a folder can contain other folders (sub-folders).
- In our example folder A contains the 2 folders B and C.
- And folder B contains 3 further folders D,E and F
now there are 3 ways to load the data:
1) with lazy=true, only the folder A is loaded and the others will be loaded on demand
2) with lazy=false, all folders get loaded, BUT
- in one query hibernate determines the child-folders of A and gets B and C
- then for every child-folder a new query is used to get their child-folders
3) but the most efficient way would be just 1 single query with a result as the following:
folder, parentFolder
A, -
B, A
C, A
D, B
E, B
F, B
Now hibernate could parse this result in order to obtain the objects.
The advantage of this way is, that you need only 1 database query.
I am pretty new to hibernate. So does anyone know if there is a solution in hibernate?
I would be grateful for your help.
|