Program: 168746
Project: 168746
Buggy source:
private <R>QuerySpecification getQuerySpecification(Query baseQuery,Query exampleQuery,String[] returningColumns,ReturningObjectBuilder<R> objectBuilder,Map<DbmsModificationState,String> includedModificationStates){
  Set<String> parameterListNames=parameterManager.getParameterListNames(baseQuery);
  boolean isEmbedded=this instanceof ReturningBuilder;
  boolean shouldRenderCteNodes=renderCteNodes(isEmbedded);
  List<CTENode> ctes=shouldRenderCteNodes ? getCteNodes(baseQuery,isEmbedded) : Collections.EMPTY_LIST;
  ExtendedQuerySupport extendedQuerySupport=getService(ExtendedQuerySupport.class);
  String sql=extendedQuerySupport.getSql(em,baseQuery);
  String ownerAlias=extendedQuerySupport.getSqlAlias(em,baseQuery,entityAlias);
  String targetAlias=extendedQuerySupport.getSqlAlias(em,baseQuery,CollectionUpdateModificationQuerySpecification.COLLECTION_BASE_QUERY_ALIAS);
  JoinTable joinTable=jpaProvider.getJoinTable(entityType,collectionName);
  int joinTableIndex=SqlUtils.indexOfTableName(sql,joinTable.getTableName());
  String collectionAlias=SqlUtils.extractAlias(sql,joinTableIndex + joinTable.getTableName().length());
  String updateSql="String_Node_Str" + joinTable.getTableName() + "String_Node_Str";
  Map<String,String> columnOnlyRemappings=new HashMap<>();
  Map<String,String> columnExpressionRemappings=new HashMap<>();
  for (  Map.Entry<String,String> entry : joinTable.getKeyColumnMappings().entrySet()) {
    columnOnlyRemappings.put(collectionAlias + "String_Node_Str" + entry.getValue(),entry.getKey());
    columnExpressionRemappings.put(collectionAlias + "String_Node_Str" + entry.getValue(),joinTable.getTableName() + "String_Node_Str" + entry.getKey());
  }
  for (  Map.Entry<String,String> entry : joinTable.getIdColumnMappings().entrySet()) {
    columnOnlyRemappings.put(ownerAlias + "String_Node_Str" + entry.getValue(),entry.getKey());
    columnExpressionRemappings.put(ownerAlias + "String_Node_Str" + entry.getValue(),joinTable.getTableName() + "String_Node_Str" + entry.getKey());
  }
  for (  Map.Entry<String,String> entry : joinTable.getTargetColumnMappings().entrySet()) {
    columnOnlyRemappings.put(targetAlias + "String_Node_Str" + entry.getValue(),entry.getKey());
    columnExpressionRemappings.put(targetAlias + "String_Node_Str" + entry.getValue(),joinTable.getTableName() + "String_Node_Str" + entry.getKey());
  }
  List<Query> setExpressionContainingUpdateQueries=new ArrayList<>();
  for (  String cachedBaseQueryString : cachedBaseQueryStrings) {
    Query setExpressionQuery=em.createQuery(cachedBaseQueryString);
    parameterListNames.addAll(parameterManager.getParameterListNames(baseQuery));
    setExpressionContainingUpdateQueries.add(setExpressionQuery);
  }
  if (returningColumns == null) {
    return new CollectionUpdateModificationQuerySpecification(this,baseQuery,exampleQuery,parameterManager.getParameters(),parameterListNames,mainQuery.cteManager.isRecursive(),ctes,shouldRenderCteNodes,isEmbedded,returningColumns,includedModificationStates,returningAttributeBindingMap,getUpdateExampleQuery(),updateSql,setExpressionContainingUpdateQueries,columnOnlyRemappings,columnExpressionRemappings);
  }
 else {
    return new ReturningCollectionUpdateModificationQuerySpecification(this,baseQuery,exampleQuery,parameterManager.getParameters(),parameterListNames,mainQuery.cteManager.isRecursive(),ctes,shouldRenderCteNodes,isEmbedded,returningColumns,includedModificationStates,returningAttributeBindingMap,getUpdateExampleQuery(),updateSql,setExpressionContainingUpdateQueries,columnOnlyRemappings,columnExpressionRemappings,objectBuilder);
  }
}

Fixed version (ground truth):
private <R>QuerySpecification getQuerySpecification(Query baseQuery,Query exampleQuery,String[] returningColumns,ReturningObjectBuilder<R> objectBuilder,Map<DbmsModificationState,String> includedModificationStates){
  Set<String> parameterListNames=parameterManager.getParameterListNames(baseQuery);
  boolean isEmbedded=this instanceof ReturningBuilder;
  boolean shouldRenderCteNodes=renderCteNodes(isEmbedded);
  List<CTENode> ctes=shouldRenderCteNodes ? getCteNodes(baseQuery,isEmbedded) : Collections.EMPTY_LIST;
  ExtendedQuerySupport extendedQuerySupport=getService(ExtendedQuerySupport.class);
  String sql=extendedQuerySupport.getSql(em,baseQuery);
  String ownerAlias=extendedQuerySupport.getSqlAlias(em,baseQuery,entityAlias);
  String targetAlias=extendedQuerySupport.getSqlAlias(em,baseQuery,CollectionUpdateModificationQuerySpecification.COLLECTION_BASE_QUERY_ALIAS);
  JoinTable joinTable=jpaProvider.getJoinTable(entityType,collectionName);
  int joinTableIndex=SqlUtils.indexOfTableName(sql,joinTable.getTableName());
  String collectionAlias=SqlUtils.extractAlias(sql,joinTableIndex + joinTable.getTableName().length());
  String updateSql="String_Node_Str" + joinTable.getTableName() + "String_Node_Str";
  Map<String,String> columnOnlyRemappings=new HashMap<>();
  Map<String,String> columnExpressionRemappings=new HashMap<>();
  if (joinTable.getKeyColumnMappings() != null) {
    for (    Map.Entry<String,String> entry : joinTable.getKeyColumnMappings().entrySet()) {
      columnOnlyRemappings.put(collectionAlias + "String_Node_Str" + entry.getValue(),entry.getKey());
      columnExpressionRemappings.put(collectionAlias + "String_Node_Str" + entry.getValue(),joinTable.getTableName() + "String_Node_Str" + entry.getKey());
    }
  }
  for (  Map.Entry<String,String> entry : joinTable.getIdColumnMappings().entrySet()) {
    columnOnlyRemappings.put(ownerAlias + "String_Node_Str" + entry.getValue(),entry.getKey());
    columnExpressionRemappings.put(ownerAlias + "String_Node_Str" + entry.getValue(),joinTable.getTableName() + "String_Node_Str" + entry.getKey());
  }
  for (  Map.Entry<String,String> entry : joinTable.getTargetColumnMappings().entrySet()) {
    columnOnlyRemappings.put(targetAlias + "String_Node_Str" + entry.getValue(),entry.getKey());
    columnExpressionRemappings.put(targetAlias + "String_Node_Str" + entry.getValue(),joinTable.getTableName() + "String_Node_Str" + entry.getKey());
  }
  List<Query> setExpressionContainingUpdateQueries=new ArrayList<>();
  for (  String cachedBaseQueryString : cachedBaseQueryStrings) {
    Query setExpressionQuery=em.createQuery(cachedBaseQueryString);
    parameterListNames.addAll(parameterManager.getParameterListNames(baseQuery));
    setExpressionContainingUpdateQueries.add(setExpressionQuery);
  }
  if (returningColumns == null) {
    return new CollectionUpdateModificationQuerySpecification(this,baseQuery,exampleQuery,parameterManager.getParameters(),parameterListNames,mainQuery.cteManager.isRecursive(),ctes,shouldRenderCteNodes,isEmbedded,returningColumns,includedModificationStates,returningAttributeBindingMap,getUpdateExampleQuery(),updateSql,setExpressionContainingUpdateQueries,columnOnlyRemappings,columnExpressionRemappings);
  }
 else {
    return new ReturningCollectionUpdateModificationQuerySpecification(this,baseQuery,exampleQuery,parameterManager.getParameters(),parameterListNames,mainQuery.cteManager.isRecursive(),ctes,shouldRenderCteNodes,isEmbedded,returningColumns,includedModificationStates,returningAttributeBindingMap,getUpdateExampleQuery(),updateSql,setExpressionContainingUpdateQueries,columnOnlyRemappings,columnExpressionRemappings,objectBuilder);
  }
}