code: private void buildJoinTree(Criteria crit)
      {
          Enumeration e = crit.getElements();
  
          while (e.hasMoreElements())
          {
              Object o = e.nextElement();
              if (o instanceof Criteria)
              {
                  buildJoinTree((Criteria) o);
              }
              else
              {
                  SelectionCriteria c = (SelectionCriteria) o;
                  
                  // BRJ skip SqlCriteria
                  if (c instanceof SqlCriteria)
                  {
                      continue;
                  }
                  
                  // BRJ: Outer join for OR
                  boolean useOuterJoin = (crit.getType() == Criteria.OR);
  
                  // BRJ: do not build join tree for subQuery attribute                  
                  if (c.getAttribute() != null && c.getAttribute() instanceof String)
                  {
  					//buildJoinTreeForColumn((String) c.getAttribute(), useOuterJoin, c.getAlias(), c.getPathClasses());
  					buildJoinTreeForColumn((String) c.getAttribute(), useOuterJoin, c.getUserAlias(), c.getPathClasses());
                  }
                  if (c instanceof FieldCriteria)
                  {
                      FieldCriteria cc = (FieldCriteria) c;
  					buildJoinTreeForColumn((String) cc.getValue(), useOuterJoin, c.getUserAlias(), c.getPathClasses());
                  }
              }
          }
      }
docs: Build the tree of joins for the given criteria