private void appendJoinsAndWheres(StringBuilder builder, String tablePrefixOrNull) {
   values.clear();
   for (Join<T, ?> join : joins) {
     builder.append(" JOIN ").append(join.daoDestination.getTablename()).append(' ');
     builder.append(join.tablePrefix).append(" ON ");
     SqlUtils.appendProperty(builder, join.sourceTablePrefix, join.joinPropertySource).append('=');
     SqlUtils.appendProperty(builder, join.tablePrefix, join.joinPropertyDestination);
   }
   boolean whereAppended = !whereCollector.isEmpty();
   if (whereAppended) {
     builder.append(" WHERE ");
     whereCollector.appendWhereClause(builder, tablePrefixOrNull, values);
   }
   for (Join<T, ?> join : joins) {
     if (!join.whereCollector.isEmpty()) {
       if (!whereAppended) {
         builder.append(" WHERE ");
         whereAppended = true;
       } else {
         builder.append(" AND ");
       }
       join.whereCollector.appendWhereClause(builder, join.tablePrefix, values);
     }
   }
 }
 /**
  * Adds the given conditions to the where clause using an logical OR. To create new conditions,
  * use the properties given in the generated dao classes.
  */
 public QueryBuilder<T> whereOr(
     WhereCondition cond1, WhereCondition cond2, WhereCondition... condMore) {
   whereCollector.add(or(cond1, cond2, condMore));
   return this;
 }
 /**
  * Adds the given conditions to the where clause using an logical AND. To create new conditions,
  * use the properties given in the generated dao classes.
  */
 public QueryBuilder<T> where(WhereCondition cond, WhereCondition... condMore) {
   whereCollector.add(cond, condMore);
   return this;
 }
 protected StringBuilder append(StringBuilder builder, Property property) {
   whereCollector.checkProperty(property);
   builder.append(tablePrefix).append('.').append('\'').append(property.columnName).append('\'');
   return builder;
 }
 /**
  * Creates a WhereCondition by combining the given conditions using AND. The returned
  * WhereCondition must be used inside {@link #where(WhereCondition, WhereCondition...)} or {@link
  * #whereOr(WhereCondition, WhereCondition, WhereCondition...)}.
  */
 public WhereCondition and(
     WhereCondition cond1, WhereCondition cond2, WhereCondition... condMore) {
   return whereCollector.combineWhereConditions(" AND ", cond1, cond2, condMore);
 }