Program: 176595
Project: 176595
Buggy source:
/** 
 * On condition.
 * @param m the m
 * @param metaModel the meta model
 * @param keyObj 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 keyObj,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 (keyObj != null && idColumn.equals(fieldName)) {
        Field[] fields=m.getIdAttribute().getBindableJavaType().getDeclaredFields();
        for (        Field field : fields) {
          if (!ReflectUtils.isTransientOrStatic(field)) {
            Attribute compositeColumn=keyObj.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 (keyObj != null && metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType()) && StringUtils.contains(fieldName,'.')) {
        fieldName=fieldName.substring(fieldName.indexOf("String_Node_Str") + 1);
        ((AbstractAttribute)keyObj.getAttribute(fieldName)).getJPAColumnName();
        translator.buildWhereClause(builder,((AbstractAttribute)keyObj.getAttribute(fieldName)).getJPAColumnName(),value,condition);
        if (partitionKey == null) {
          partitionKey=keyObj.getAttribute(fieldName).getName();
        }
        if (!allowFiltering) {
          allowFiltering=fieldName.equals(partitionKey);
        }
      }
 else       if (idColumn.equals(fieldName)) {
        translator.buildWhereClause(builder,CassandraUtilities.getIdColumnName(m,externalProperties),value,condition);
      }
 else {
        translator.buildWhereClause(builder,fieldName,value,condition);
        allowFiltering=true;
      }
    }
  }
  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 keyObj 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 keyObj,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 (keyObj != null && idColumn.equals(fieldName)) {
        Field[] fields=m.getIdAttribute().getBindableJavaType().getDeclaredFields();
        for (        Field field : fields) {
          if (!ReflectUtils.isTransientOrStatic(field)) {
            Attribute compositeColumn=keyObj.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 (keyObj != null && metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType()) && StringUtils.contains(fieldName,'.')) {
        fieldName=fieldName.substring(fieldName.indexOf("String_Node_Str") + 1);
        ((AbstractAttribute)keyObj.getAttribute(fieldName)).getJPAColumnName();
        translator.buildWhereClause(builder,((AbstractAttribute)keyObj.getAttribute(fieldName)).getBindableJavaType(),((AbstractAttribute)keyObj.getAttribute(fieldName)).getJPAColumnName(),value,condition);
        if (partitionKey == null) {
          partitionKey=keyObj.getAttribute(fieldName).getName();
        }
        if (!allowFiltering) {
          allowFiltering=fieldName.equals(partitionKey);
        }
      }
 else       if (idColumn.equals(fieldName)) {
        translator.buildWhereClause(builder,((AbstractAttribute)m.getIdAttribute()).getBindableJavaType(),CassandraUtilities.getIdColumnName(m,externalProperties),value,condition);
      }
 else {
        Metamodel metamodel=KunderaMetadataManager.getMetamodel(m.getPersistenceUnit());
        Attribute attribute=((MetamodelImpl)metamodel).getEntityAttribute(m.getEntityClazz(),m.getFieldName(fieldName));
        translator.buildWhereClause(builder,((AbstractAttribute)attribute).getBindableJavaType(),fieldName,value,condition);
        allowFiltering=true;
      }
    }
  }
  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;
}