我想得到一个list,包含所有层次的子list, 用了以下这样的程序,老是觉得有错,有哪个高手可以帮忙啊?????????????????????不胜感激~!!!!!!!!!!!!!


public java.util.List listByParentID(int parentID) throws Exception
   {
      
    try{
        List listAdd=null;
        Session session=this.getSession();
           Query query=session.createQuery("from net.vschool.forum.ForumSpeak as category where parentID=? order category.id DESC");
           query.setInteger(0,parentID);
           list=query.list();            
        int ID=parentID;
           ForumSpeak forumSpeak=new ForumSpeak();
         while(list.size()>0)
        {
               forumSpeak.setParentID(new Integer(ID));
            net.vschool.forum.dao.ForumSpeakDAO dao=net.vschool.forum.dao.ForumSpeakDAO.getInstance();
            listAdd=dao.listByParentID(parentID);  
        }
        list.add(listAdd);
        
          }catch(Exception e){
                   throw e;
    }
    
    return list;
}