Tree from one table with Parent and Children, creating a tree view

Posts   
 
    
bvalle
User
Posts: 54
Joined: 07-Jun-2006
# Posted on: 10-Oct-2006 20:41:07   

Hello there.

I have the following table.

ParentNode | ChildNode | NodeLevel

I am using the table above to create a tree view, which I initially populate by filtering out the NodeLevel == 0 and getting all related Records. I would like to pull the next level down for matching Child when they are parents. I am under the impression that I cannot create a prefetch on this since I cannot create a link between ParentNode and ChildNode. I also understand I could do this with two separate calls to the database where I could filter out the ParentNode where the ParenteNode is equal to the returned ChildNode from the first query and NodeLevel == 1.

Is there a way to do this call with only one call to the database?

I am using LLBLGen Pro1.0.2005.1 Final.

Thank you, Bruno Valle

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 11-Oct-2006 03:14:54   

You can define relationships on two columns in the same table and then use this relationship in prefetch paths all you want. I would recommend that you use the designer to change the name of the mapped entity (Parent) and Collection (Children).