File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Recursion inside while loop

 
B M Tejaswi
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Am trying to write a method that fetches records from DB and prepares a tree. I have uniqueID and parentID fields in records. Am trying to find a parent from the already built tree to insert new records using recursion. But my tree only builds upto level 2. After that it fails to return proper parent nodes. Below is my code
//Code calling the recursive code :


In recursive method i have to return the previous parent node to continue iteration of while loop. But am not able to figure out what i should return. Please help asap.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic