code: private void prepareQuery()
          throws EFapsException
      {
          for (final QueryBuilder queryBldr : this.attrQueryBldrs.values()) {
              final AttributeQuery attrQuery = queryBldr.getAttributeQuery();
              this.addWhereAttrInQuery(queryBldr.getLinkAttributeName(), attrQuery);
          }
  
          if (!this.types.isEmpty()) {
              // force the include
              this.query.setIncludeChildTypes(true);
              final Type baseType = Type.get(this.typeUUID);
              final QEqual eqPart = new QEqual(new QAttribute(baseType.getTypeAttribute()));
  
              for (final UUID type : this.types) {
                  eqPart.addValue(new QNumberValue(Type.get(type).getId()));
              }
              this.compares.add(eqPart);
          }
  
          if (!this.compares.isEmpty()) {
              final QAnd and = this.or ? new QOr() : new QAnd();
              for (final AbstractQAttrCompare compare : this.compares) {
                  and.addPart(compare);
              }
              this.query.setWhere(new QWhereSection(and));
          }
          if (!this.orders.isEmpty()) {
              final QOrderBySection orderBy = new QOrderBySection(
                              this.orders.toArray(new AbstractQPart[this.orders.size()]));
              this.query.setOrderBy(orderBy);
          }
          if (this.limit > 0) {
              this.query.setLimit(this.limit);
          }
      }
docs: Prepare the Query.
  @throws EFapsException on error