wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Recursive Tree Problem... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Recursive Tree Problem..." Watch "Recursive Tree Problem..." New topic

Recursive Tree Problem...

Sanket L Shah
Ranch Hand

Joined: May 08, 2009
Posts: 49

Hi all,

I am developing one application using hibernate and Swing.
I am having one user class.

I have given lazy = "false" in user.cfg.xml. When I run this program using void main... it works well...
now my problem is how can I iterate loop so i can get all the data in tree structure...
I wanted to display the data in Tree Structure... but not able to write correct recursive loop...
Please help me out.....

Thank you so much....

Jeff Storey
Ranch Hand

Joined: Apr 07, 2007
Posts: 230

What have you tried so far? What comes to mind is iterating over each user and printing out its sub-users recursively, for example:

This assumes there are no cyclical relationships. This may not be exactly what you want, but hopefully it should help get you started.


Jeff Storey
Software Developer
Sanket L Shah
Ranch Hand

Joined: May 08, 2009
Posts: 49

Hey tha Jeff Storey
MY problem is solved......
Thank you so much....
It is sorta covered in the JavaRanch Style Guide.
subject: Recursive Tree Problem...
Similar Threads
Recursive Tree Problem
Tree Recursive problem
Making binary tree: memory problem
Trying to bind data to a TreeNode attribute using data read from a web service with simple xml
Recursive object creation from List