code: protected QPath traverseQPathSQ(String cpid) throws SQLException, InvalidItemStateException, IllegalNameException
     {
        // get item by Identifier usecase 
        List<QPathEntry> qrpath = new ArrayList<QPathEntry>(); // reverted path
        String caid = cpid; // container ancestor id
        do
        {
           ResultSet parent = findItemByIdentifier(caid);
           try
           {
              if (!parent.next())
              {
                 throw new InvalidItemStateException("Parent not found, uuid: " + getIdentifier(caid));
              }
  
              QPathEntry qpe =
                 new QPathEntry(InternalQName.parse(parent.getString(COLUMN_NAME)), parent.getInt(COLUMN_INDEX), getIdentifier(caid));
              qrpath.add(qpe);
              caid = parent.getString(COLUMN_PARENTID);
  
              if (caid.equals(parent.getString(COLUMN_ID)))
              {
                 throw new InvalidItemStateException("An item with id='" + getIdentifier(caid) + "' is its own parent");
              }
           }
           finally
           {
              try
              {
                 parent.close();
              }
              catch (SQLException e)
              {
                 LOG.error("Can't close the ResultSet: " + e.getMessage());
              }
           }
        }
        while (!caid.equals(Constants.ROOT_PARENT_UUID));
  
        QPathEntry[] qentries = new QPathEntry[qrpath.size()];
        int qi = 0;
        for (int i = qrpath.size() - 1; i >= 0; i--)
        {
           qentries[qi++] = qrpath.get(i);
        }
        return new QPath(qentries);
     }
docs: The method <code>traverseQPath</code> implemented thanks to simple queries. It allows
  to use Simple Queries instead of Complex Queries when complex queries are much slower such
  as with HSQLDB for example.