Recursive prefetches?

Posts   
 
    
SLJ
User
Posts: 3
Joined: 19-Sep-2005
# Posted on: 10-Dec-2005 01:22:29   

I am not sure that there is a way to do this one. I am working with a typical tree structure of groups, which can contain either items or more groups. Is there a way to do a recursive prefetch, so I am able to prefetch the entire tree and traverse it without executing sql queries every time I move one step up/down the tree?

I am using SelfServicing with SQL Server 2000.

/Stefan

sparmar2000 avatar
Posts: 341
Joined: 30-Nov-2003
# Posted on: 10-Dec-2005 17:25:01   

Stefan, This should be possible, but without a view of a sample SQL this will be very theorical. Please can you supply the SQL?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 12-Dec-2005 10:35:59   

Additionally, as the hierarchy is stored inside the same table, you can fetch the table in 1 collection and build the complete tree from that single collection using a hashtable which keeps track of entity - node pairs.

This is a O(n) algorithm where you traverse the collection once and at the end you have your tree. I'm not sure if that's feasable in your situation though, the tree might be very big and you therefore might want to use load on demand for nodes.

Frans Bouma | Lead developer LLBLGen Pro