Program: 176656
Project: 176656
Buggy source:
/** 
 * On condition.
 * @param m the m
 * @param metaModel the meta model
 * @param compoundKey the compound key
 * @param idColumn the id column
 * @param builder the builder
 * @param isPresent the is present
 * @param translator the translator
 * @return true, if successful
 */
private boolean onCondition(EntityMetadata m,MetamodelImpl metaModel,EmbeddableType compoundKey,String idColumn,StringBuilder builder,boolean isPresent,CQLTranslator translator){
  String partitionKey=null;
  boolean allowFiltering=false;
  for (  Object o : getKunderaQuery().getFilterClauseQueue()) {
    if (o instanceof FilterClause) {
      FilterClause clause=((FilterClause)o);
      String fieldName=clause.getProperty();
      String condition=clause.getCondition();
      Object value=clause.getValue();
      isPresent=true;
      if (idColumn.equals(fieldName)) {
        Field[] fields=m.getIdAttribute().getBindableJavaType().getDeclaredFields();
        for (        Field field : fields) {
          Attribute compositeColumn=compoundKey.getAttribute(field.getName());
          translator.buildWhereClause(builder,((AbstractAttribute)compositeColumn).getJPAColumnName(),field,value);
          if (partitionKey == null) {
            partitionKey=compositeColumn.getName();
          }
          if (!allowFiltering) {
            allowFiltering=fieldName.equals(partitionKey);
          }
        }
      }
 else       if (metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType()) && StringUtils.contains(fieldName,'.')) {
        fieldName=fieldName.substring(fieldName.indexOf("String_Node_Str") + 1);
        ((AbstractAttribute)compoundKey.getAttribute(fieldName)).getJPAColumnName();
        translator.buildWhereClause(builder,((AbstractAttribute)compoundKey.getAttribute(fieldName)).getJPAColumnName(),value,condition);
        if (partitionKey == null) {
          partitionKey=compoundKey.getAttribute(fieldName).getName();
        }
        if (!allowFiltering) {
          allowFiltering=fieldName.equals(partitionKey);
        }
      }
 else {
        Field[] fields=m.getIdAttribute().getBindableJavaType().getDeclaredFields();
        Attribute compositeColumn=compoundKey.getAttribute(fields[0].getName());
        if (partitionKey == null) {
          partitionKey=compositeColumn.getName();
        }
        if (!allowFiltering) {
          allowFiltering=fieldName.equals(partitionKey);
        }
        translator.buildWhereClause(builder,fieldName,value,condition);
      }
    }
  }
  if (isPresent) {
    builder.delete(builder.lastIndexOf(CQLTranslator.AND_CLAUSE),builder.length());
  }
  if (allowFiltering) {
    onLimit(builder);
    builder.append("String_Node_Str");
    translator.buildFilteringClause(builder);
  }
 else {
    onLimit(builder);
  }
  return isPresent;
}

Fixed version (ground truth):
/** 
 * On condition.
 * @param m the m
 * @param metaModel the meta model
 * @param compoundKey the compound key
 * @param idColumn the id column
 * @param builder the builder
 * @param isPresent the is present
 * @param translator the translator
 * @return true, if successful
 */
private boolean onCondition(EntityMetadata m,MetamodelImpl metaModel,EmbeddableType compoundKey,String idColumn,StringBuilder builder,boolean isPresent,CQLTranslator translator){
  String partitionKey=null;
  boolean allowFiltering=false;
  for (  Object o : getKunderaQuery().getFilterClauseQueue()) {
    if (o instanceof FilterClause) {
      FilterClause clause=((FilterClause)o);
      String fieldName=clause.getProperty();
      String condition=clause.getCondition();
      Object value=clause.getValue();
      isPresent=true;
      if (idColumn.equals(fieldName)) {
        Field[] fields=m.getIdAttribute().getBindableJavaType().getDeclaredFields();
        for (        Field field : fields) {
          if (!ReflectUtils.isTransientOrStatic(field)) {
            Attribute compositeColumn=compoundKey.getAttribute(field.getName());
            translator.buildWhereClause(builder,((AbstractAttribute)compositeColumn).getJPAColumnName(),field,value);
            if (partitionKey == null) {
              partitionKey=compositeColumn.getName();
            }
            if (!allowFiltering) {
              allowFiltering=fieldName.equals(partitionKey);
            }
          }
        }
      }
 else       if (metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType()) && StringUtils.contains(fieldName,'.')) {
        fieldName=fieldName.substring(fieldName.indexOf("String_Node_Str") + 1);
        ((AbstractAttribute)compoundKey.getAttribute(fieldName)).getJPAColumnName();
        translator.buildWhereClause(builder,((AbstractAttribute)compoundKey.getAttribute(fieldName)).getJPAColumnName(),value,condition);
        if (partitionKey == null) {
          partitionKey=compoundKey.getAttribute(fieldName).getName();
        }
        if (!allowFiltering) {
          allowFiltering=fieldName.equals(partitionKey);
        }
      }
 else {
        Field[] fields=m.getIdAttribute().getBindableJavaType().getDeclaredFields();
        Attribute compositeColumn=compoundKey.getAttribute(fields[0].getName());
        if (partitionKey == null) {
          partitionKey=compositeColumn.getName();
        }
        if (!allowFiltering) {
          allowFiltering=fieldName.equals(partitionKey);
        }
        translator.buildWhereClause(builder,fieldName,value,condition);
      }
    }
  }
  if (isPresent) {
    builder.delete(builder.lastIndexOf(CQLTranslator.AND_CLAUSE),builder.length());
  }
  if (allowFiltering) {
    onLimit(builder);
    builder.append("String_Node_Str");
    translator.buildFilteringClause(builder);
  }
 else {
    onLimit(builder);
  }
  return isPresent;
}