nus-yam/ex-repair huggingface dataset:
Program: 176293
Project: 176293
Buggy source:
public static boolean isEmptyOrNull(Object o){
  if (o == null) {
    return true;
  }
  if (PropertyAccessorHelper.isCollection(o.getClass())) {
    Collection c=(Collection)o;
    if (c.isEmpty()) {
      return true;
    }
  }
 else   if (Map.class.isAssignableFrom(o.getClass())) {
    Map m=(Map)o;
    if (m.isEmpty()) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public static boolean isEmptyOrNull(Object o){
  if (o == null) {
    return true;
  }
  if (!ProxyHelper.isProxyOrCollection(o)) {
    if (PropertyAccessorHelper.isCollection(o.getClass())) {
      Collection c=(Collection)o;
      if (c.isEmpty()) {
        return true;
      }
    }
 else     if (Map.class.isAssignableFrom(o.getClass())) {
      Map m=(Map)o;
      if (m.isEmpty()) {
        return true;
      }
    }
  }
  return false;
}
Program: 176296
Project: 176296
Buggy source:
/** 
 * Appends a object of type   {@link java.util.List}
 * @param builder
 * @param value
 * @return
 */
private boolean appendMap(StringBuilder builder,Object value){
  boolean isPresent=false;
  Map map=((Map)value);
  if (!map.isEmpty()) {
    isPresent=true;
    builder.append("String_Node_Str");
    for (    Object mapKey : map.keySet()) {
      Object mapValue=map.get(mapKey);
      if (mapKey != null && mapValue != null) {
        appendValue(builder,mapKey.getClass(),mapKey);
        builder.append("String_Node_Str");
        appendValue(builder,mapValue.getClass(),mapValue);
      }
      builder.append("String_Node_Str");
    }
    builder.deleteCharAt(builder.length() - 1);
    builder.append("String_Node_Str");
  }
  return isPresent;
}

Fixed version (ground truth):
/** 
 * Appends a object of type   {@link java.util.List}
 * @param builder
 * @param value
 * @return
 */
private boolean appendMap(StringBuilder builder,Object value){
  boolean isPresent=false;
  Map map=((Map)value);
  isPresent=true;
  builder.append("String_Node_Str");
  for (  Object mapKey : map.keySet()) {
    Object mapValue=map.get(mapKey);
    if (mapKey != null && mapValue != null) {
      appendValue(builder,mapKey.getClass(),mapKey);
      builder.append("String_Node_Str");
      appendValue(builder,mapValue.getClass(),mapValue);
    }
    builder.append("String_Node_Str");
  }
  if (!map.isEmpty()) {
    builder.deleteCharAt(builder.length() - 1);
  }
  builder.append("String_Node_Str");
  return isPresent;
}
Program: 176297
Project: 176297
Buggy source:
/** 
 * Appends a object of type   {@link java.util.Map}
 * @param builder
 * @param value
 * @return
 */
private boolean appendSet(StringBuilder builder,Object value){
  boolean isPresent=false;
  Collection collection=((Collection)value);
  if (!collection.isEmpty()) {
    isPresent=true;
    builder.append("String_Node_Str");
    for (    Object o : collection) {
      if (o != null) {
        appendValue(builder,o.getClass(),o);
      }
      builder.append("String_Node_Str");
    }
    builder.deleteCharAt(builder.length() - 1);
    builder.append("String_Node_Str");
  }
  return isPresent;
}

Fixed version (ground truth):
/** 
 * Appends a object of type   {@link java.util.Map}
 * @param builder
 * @param value
 * @return
 */
private boolean appendSet(StringBuilder builder,Object value){
  boolean isPresent=false;
  Collection collection=((Collection)value);
  isPresent=true;
  builder.append("String_Node_Str");
  for (  Object o : collection) {
    if (o != null) {
      appendValue(builder,o.getClass(),o);
    }
    builder.append("String_Node_Str");
  }
  if (!collection.isEmpty()) {
    builder.deleteCharAt(builder.length() - 1);
  }
  builder.append("String_Node_Str");
  return isPresent;
}
Program: 176298
Project: 176298
Buggy source:
/** 
 * Appends a object of type   {@link java.util.List}
 * @param builder
 * @param value
 * @return
 */
private boolean appendList(StringBuilder builder,Object value){
  boolean isPresent=false;
  Collection collection=((Collection)value);
  if (!collection.isEmpty()) {
    isPresent=true;
    builder.append("String_Node_Str");
    for (    Object o : collection) {
      if (o != null) {
        appendValue(builder,o.getClass(),o);
      }
      builder.append("String_Node_Str");
    }
    builder.deleteCharAt(builder.length() - 1);
    builder.append("String_Node_Str");
  }
  return isPresent;
}

Fixed version (ground truth):
/** 
 * Appends a object of type   {@link java.util.List}
 * @param builder
 * @param value
 * @return
 */
private boolean appendList(StringBuilder builder,Object value){
  boolean isPresent=false;
  Collection collection=((Collection)value);
  isPresent=true;
  builder.append("String_Node_Str");
  for (  Object o : collection) {
    if (o != null) {
      appendValue(builder,o.getClass(),o);
    }
    builder.append("String_Node_Str");
  }
  if (!collection.isEmpty()) {
    builder.deleteCharAt(builder.length() - 1);
  }
  builder.append("String_Node_Str");
  return isPresent;
}
Program: 176299
Project: 176299
Buggy source:
/** 
 * Removes an object from Index.
 * @param metadata the metadata
 * @param entity the entity
 * @param key the key
 */
public final void remove(EntityMetadata metadata,Object entity,String key){
  if (indexer != null) {
    if (indexer.getClass().isAssignableFrom(LuceneIndexer.class)) {
      ((com.impetus.kundera.index.lucene.Indexer)indexer).unindex(metadata,key);
    }
 else {
      indexer.unIndex(metadata.getEntityClazz(),key);
    }
  }
}

Fixed version (ground truth):
/** 
 * Removes an object from Index.
 * @param metadata the metadata
 * @param entity the entity
 * @param key the key
 */
public final void remove(EntityMetadata metadata,Object entity,String key){
  if (indexer != null) {
    if (indexer.getClass().isAssignableFrom(LuceneIndexer.class)) {
      ((com.impetus.kundera.index.lucene.Indexer)indexer).unindex(metadata,key);
    }
 else {
      indexer.unIndex(metadata.getEntityClazz(),entity);
    }
  }
}
Program: 176300
Project: 176300
Buggy source:
@Override public void unIndex(Class entityClazz,Object key){
  EntityMetadata metadata=KunderaMetadataManager.getEntityMetadata(entityClazz);
  DeleteResponse response=client.prepareDelete(metadata.getSchema().toLowerCase(),entityClazz.getSimpleName(),key.toString()).execute().actionGet();
}

Fixed version (ground truth):
@Override public void unIndex(Class entityClazz,Object entity){
  EntityMetadata metadata=KunderaMetadataManager.getEntityMetadata(entityClazz);
  Object id=PropertyAccessorHelper.getId(entity,metadata);
  DeleteResponse response=client.prepareDelete(metadata.getSchema().toLowerCase(),entityClazz.getSimpleName(),id.toString()).execute().actionGet();
}
Program: 176302
Project: 176302
Buggy source:
private void addColumnFamilies(List<TableInfo> tableInfos,HTableDescriptor hTableDescriptor,boolean isUpdate) throws IOException {
  if (admin.isTableEnabled(databaseName)) {
    admin.disableTable(databaseName);
  }
  for (  TableInfo tableInfo : tableInfos) {
    HColumnDescriptor columnDescriptor=hTableDescriptor.getFamily(tableInfo.getTableName().getBytes());
    if (columnDescriptor != null && !isUpdate) {
      admin.deleteColumn(databaseName,tableInfo.getTableName());
      addColumn(tableInfo);
    }
 else     if (columnDescriptor == null) {
      addColumn(tableInfo);
    }
  }
}

Fixed version (ground truth):
private void addColumnFamilies(List<TableInfo> tableInfos,HTableDescriptor hTableDescriptor,boolean isUpdate) throws IOException {
  if (admin.isTableEnabled(databaseName)) {
    admin.disableTable(databaseName);
  }
  for (  TableInfo tableInfo : tableInfos) {
    HColumnDescriptor columnDescriptor=hTableDescriptor.getFamily(tableInfo.getTableName().getBytes());
    if (columnDescriptor != null && !isUpdate) {
      admin.deleteColumn(databaseName,tableInfo.getTableName());
      addColumn(tableInfo);
    }
 else     if (columnDescriptor == null) {
      addColumn(tableInfo);
    }
  }
  if (admin.isTableDisabled(databaseName)) {
    admin.enableTable(databaseName);
  }
}
Program: 176304
Project: 176304
Buggy source:
/** 
 * @param tableInfo
 * @throws InvalidRequestException
 * @throws SchemaDisagreementException
 * @throws TException
 * @throws NotFoundException
 * @throws UnsupportedEncodingException
 * @throws UnavailableException
 * @throws TimedOutException
 */
private void createOrUpdateColumnFamily(TableInfo tableInfo,KsDef ksDef) throws Exception {
  MetaDataHandler handler=new MetaDataHandler();
  if (containsCompositeKey(tableInfo)) {
    validateCompoundKey(tableInfo);
    onCompoundKey(tableInfo,ksDef);
    createIndexUsingCql(tableInfo);
  }
 else   if (containsCollectionColumns(tableInfo)) {
    createOrUpdateUsingCQL3(tableInfo,ksDef);
    createIndexUsingCql(tableInfo);
  }
 else {
    CfDef cf_def=handler.getTableMetadata(tableInfo);
    try {
      cassandra_client.system_add_column_family(cf_def);
    }
 catch (    InvalidRequestException irex) {
      updateExistingColumnFamily(tableInfo,ksDef,irex);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param tableInfo
 * @throws InvalidRequestException
 * @throws SchemaDisagreementException
 * @throws TException
 * @throws NotFoundException
 * @throws UnsupportedEncodingException
 * @throws UnavailableException
 * @throws TimedOutException
 */
private void createOrUpdateColumnFamily(TableInfo tableInfo,KsDef ksDef) throws Exception {
  MetaDataHandler handler=new MetaDataHandler();
  if (containsCompositeKey(tableInfo)) {
    validateCompoundKey(tableInfo);
    createOrUpdateUsingCQL3(tableInfo,ksDef);
    createIndexUsingCql(tableInfo);
  }
 else   if (containsCollectionColumns(tableInfo)) {
    createOrUpdateUsingCQL3(tableInfo,ksDef);
    createIndexUsingCql(tableInfo);
  }
 else {
    CfDef cf_def=handler.getTableMetadata(tableInfo);
    try {
      cassandra_client.system_add_column_family(cf_def);
    }
 catch (    InvalidRequestException irex) {
      updateExistingColumnFamily(tableInfo,ksDef,irex);
    }
  }
}
Program: 176307
Project: 176307
Buggy source:
/** 
 * Method to execute cql query and return back entity/enhance entities.
 * @param cqlQuery cql query to be executed.
 * @param clazz entity class.
 * @param relationalField collection for relational fields.
 * @return list of objects.
 */
@Override public List executeQuery(String cqlQuery,Class clazz,List<String> relationalField){
  return super.executeQuery(cqlQuery,clazz,relationalField,dataHandler);
}

Fixed version (ground truth):
/** 
 * Method to execute cql query and return back entity/enhance entities.
 * @param cqlQuery cql query to be executed.
 * @param clazz entity class.
 * @param relationalField collection for relational fields.
 * @return list of objects.
 */
@Override public List executeQuery(String cqlQuery,Class clazz,List<String> relationalField){
  return super.executeSelectQuery(cqlQuery,clazz,relationalField,dataHandler);
}
Program: 176308
Project: 176308
Buggy source:
/** 
 * On executeUpdate.
 * @return zero
 */
@Override protected int onExecuteUpdate(){
  EntityMetadata m=getEntityMetadata();
  if (KunderaMetadata.INSTANCE.getApplicationMetadata().isNative(getJPAQuery())) {
    ((CassandraClientBase)persistenceDelegeator.getClient(m)).executeQuery(KunderaMetadata.INSTANCE.getApplicationMetadata().getQuery(getJPAQuery()),m.getEntityClazz(),null);
  }
 else   if (kunderaQuery.isDeleteUpdate()) {
    List result=getResultList();
    return result != null ? result.size() : 0;
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * On executeUpdate.
 * @return zero
 */
@Override protected int onExecuteUpdate(){
  EntityMetadata m=getEntityMetadata();
  if (KunderaMetadata.INSTANCE.getApplicationMetadata().isNative(getJPAQuery())) {
    ((CassandraClientBase)persistenceDelegeator.getClient(m)).executeQuery(KunderaMetadata.INSTANCE.getApplicationMetadata().getQuery(getJPAQuery()),m.getEntityClazz(),null);
  }
 else   if (kunderaQuery.isDeleteUpdate()) {
    if (!isQueryConvertibleToCQL(kunderaQuery)) {
      List result=getResultList();
      return result != null ? result.size() : 0;
    }
 else {
      String query=null;
      if (kunderaQuery.isUpdateClause()) {
        query=createUpdateQuery(kunderaQuery);
      }
 else {
        query=createDeleteQuery(kunderaQuery);
      }
      return ((CassandraClientBase)persistenceDelegeator.getClient(m)).executeUpdateDeleteQuery(query);
    }
  }
  return 0;
}
Program: 176309
Project: 176309
Buggy source:
/** 
 * Query related methods 
 */
@Override public List executeQuery(String cqlQuery,Class clazz,List<String> relationalField){
  return super.executeQuery(cqlQuery,clazz,relationalField,dataHandler);
}

Fixed version (ground truth):
/** 
 * Query related methods 
 */
@Override public List executeQuery(String cqlQuery,Class clazz,List<String> relationalField){
  return super.executeSelectQuery(cqlQuery,clazz,relationalField,dataHandler);
}
Program: 176310
Project: 176310
Buggy source:
@Override public void persistJoinTable(JoinTableData joinTableData){
  String joinTableName=joinTableData.getJoinTableName();
  String invJoinColumnName=joinTableData.getInverseJoinColumnName();
  Map<Object,Set<Object>> joinTableRecords=joinTableData.getJoinTableRecords();
  for (  Object key : joinTableRecords.keySet()) {
    Set<Object> values=joinTableRecords.get(key);
    Object joinColumnValue=key;
    Map<String,Object> columns=new HashMap<String,Object>();
    for (    Object childValue : values) {
      Object invJoinColumnValue=childValue;
      columns.put(invJoinColumnName + "String_Node_Str" + invJoinColumnValue,invJoinColumnValue);
    }
    if (columns != null && !columns.isEmpty()) {
      try {
        handler.createTableIfDoesNotExist(joinTableName,joinTableName);
        handler.writeJoinTableData(joinTableName,joinColumnValue,columns,joinTableName);
      }
 catch (      IOException e) {
        throw new PersistenceException(e);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void persistJoinTable(JoinTableData joinTableData){
  String joinTableName=joinTableData.getJoinTableName();
  String invJoinColumnName=joinTableData.getInverseJoinColumnName();
  Map<Object,Set<Object>> joinTableRecords=joinTableData.getJoinTableRecords();
  for (  Object key : joinTableRecords.keySet()) {
    Set<Object> values=joinTableRecords.get(key);
    Object joinColumnValue=key;
    Map<String,Object> columns=new HashMap<String,Object>();
    for (    Object childValue : values) {
      Object invJoinColumnValue=childValue;
      columns.put(invJoinColumnName + "String_Node_Str" + invJoinColumnValue,invJoinColumnValue);
    }
    if (columns != null && !columns.isEmpty()) {
      try {
        handler.createTableIfDoesNotExist(joinTableData.getSchemaName(),joinTableName);
        handler.writeJoinTableData(joinTableData.getSchemaName(),joinColumnValue,columns,joinTableName);
      }
 catch (      IOException e) {
        throw new PersistenceException(e);
      }
    }
  }
}
Program: 176311
Project: 176311
Buggy source:
/** 
 * Writes data into Join Table.
 * @param tableName the table name
 * @param rowId the row id
 * @param columns the columns
 * @throws IOException Signals that an I/O exception has occurred.
 */
void writeJoinTableData(String tableName,Object rowId,Map<String,Object> columns,String joinTableName) throws IOException ;

Fixed version (ground truth):
/** 
 * Writes data into Join Table.
 * @param tableName the table name
 * @param rowId the row id
 * @param columns the columns
 * @throws IOException Signals that an I/O exception has occurred.
 */
void writeJoinTableData(String tableName,Object rowId,Map<String,Object> columns,String columnFamilyName) throws IOException ;
Program: 176312
Project: 176312
Buggy source:
@Override public void writeData(String tableName,EntityMetadata m,Object entity,Object rowId,List<RelationHolder> relations) throws IOException {
  HTableInterface hTable=gethTable(tableName);
  MetamodelImpl metaModel=(MetamodelImpl)KunderaMetadata.INSTANCE.getApplicationMetadata().getMetamodel(m.getPersistenceUnit());
  EntityType entityType=metaModel.entity(m.getEntityClazz());
  Set<Attribute> attributes=entityType.getAttributes();
  HBaseDataWrapper columnWrapper=new HBaseDataWrapper(rowId,new java.util.HashMap<String,Attribute>(),entity,null);
  List<HBaseDataWrapper> persistentData=new ArrayList<HBaseDataHandler.HBaseDataWrapper>(attributes.size());
  preparePersistentData(tableName,m.getTableName(),entity,rowId,metaModel,attributes,columnWrapper,persistentData);
  hbaseWriter.writeColumns(hTable,columnWrapper.getRowKey(),columnWrapper.getColumns(),entity,m.getTableName());
  for (  HBaseDataWrapper wrapper : persistentData) {
    hbaseWriter.writeColumns(hTable,wrapper.getColumnFamily(),wrapper.getRowKey(),wrapper.getColumns(),wrapper.getEntity());
  }
  boolean containsEmbeddedObjectsOnly=columnWrapper.getColumns().isEmpty() && persistentData.isEmpty();
  if (relations != null && !relations.isEmpty()) {
    hbaseWriter.writeRelations(hTable,rowId,containsEmbeddedObjectsOnly,relations,m.getTableName());
  }
  puthTable(hTable);
}

Fixed version (ground truth):
@Override public void writeData(String tableName,EntityMetadata m,Object entity,Object rowId,List<RelationHolder> relations) throws IOException {
  HTableInterface hTable=gethTable(tableName);
  MetamodelImpl metaModel=(MetamodelImpl)KunderaMetadata.INSTANCE.getApplicationMetadata().getMetamodel(m.getPersistenceUnit());
  EntityType entityType=metaModel.entity(m.getEntityClazz());
  Set<Attribute> attributes=entityType.getAttributes();
  HBaseDataWrapper columnWrapper=new HBaseDataWrapper(rowId,new java.util.HashMap<String,Attribute>(),entity,null);
  List<HBaseDataWrapper> persistentData=new ArrayList<HBaseDataHandler.HBaseDataWrapper>(attributes.size());
  preparePersistentData(tableName,m.getTableName(),entity,rowId,metaModel,attributes,columnWrapper,persistentData);
  hbaseWriter.writeColumns(hTable,columnWrapper.getRowKey(),columnWrapper.getColumns(),entity,m.getTableName());
  for (  HBaseDataWrapper wrapper : persistentData) {
    hbaseWriter.writeColumns(hTable,wrapper.getColumnFamily(),wrapper.getRowKey(),wrapper.getColumns(),wrapper.getValues(),wrapper.getEntity());
  }
  boolean containsEmbeddedObjectsOnly=columnWrapper.getColumns().isEmpty() && persistentData.isEmpty();
  if (relations != null && !relations.isEmpty()) {
    hbaseWriter.writeRelations(hTable,rowId,containsEmbeddedObjectsOnly,relations,m.getTableName());
  }
  puthTable(hTable);
}
Program: 176313
Project: 176313
Buggy source:
/** 
 * @param rowKey
 * @param columns
 * @param entity
 * @param columnFamily
 */
public HBaseDataWrapper(Object rowKey,Map<String,Attribute> columns,Object entity,String columnFamily){
  super();
  this.rowKey=rowKey;
  this.columns=columns;
  this.entity=entity;
  this.columnFamily=columnFamily;
}

Fixed version (ground truth):
public HBaseDataWrapper(Object rowKey,Map<String,Attribute> columns,Map<String,Object> values,Object entity,String columnFamily){
  super();
  this.rowKey=rowKey;
  this.columns=columns;
  this.values=values;
  this.entity=entity;
  this.columnFamily=columnFamily;
}
Program: 176314
Project: 176314
Buggy source:
@Override public void writeJoinTableData(String tableName,Object rowId,Map<String,Object> columns,String joinTableName) throws IOException {
  HTableInterface hTable=gethTable(tableName);
  hbaseWriter.writeColumns(hTable,rowId,columns,joinTableName);
  puthTable(hTable);
}

Fixed version (ground truth):
@Override public void writeJoinTableData(String tableName,Object rowId,Map<String,Object> columns,String columnFamilyName) throws IOException {
  HTableInterface hTable=gethTable(tableName);
  hbaseWriter.writeColumns(hTable,rowId,columns,columnFamilyName);
  puthTable(hTable);
}
Program: 176316
Project: 176316
Buggy source:
@Override public void persistRows(Map<HTableInterface,List<HBaseDataWrapper>> rows) throws IOException {
  List<Put> dataSet=new ArrayList<Put>(rows.size());
  for (  HTableInterface hTable : rows.keySet()) {
    List<HBaseDataWrapper> row=rows.get(hTable);
    for (    HBaseDataWrapper data : row) {
      dataSet.add(preparePut(data.getColumnFamily(),data.getRowKey(),data.getColumns(),data.getEntity()));
    }
    hTable.put(dataSet);
    dataSet.clear();
  }
}

Fixed version (ground truth):
@Override public void persistRows(Map<HTableInterface,List<HBaseDataWrapper>> rows) throws IOException {
  List<Put> dataSet=new ArrayList<Put>(rows.size());
  for (  HTableInterface hTable : rows.keySet()) {
    List<HBaseDataWrapper> row=rows.get(hTable);
    for (    HBaseDataWrapper data : row) {
      dataSet.add(preparePut(data.getColumnFamily(),data.getRowKey(),data.getColumns(),data.getValues()));
    }
    hTable.put(dataSet);
    dataSet.clear();
  }
}
Program: 176317
Project: 176317
Buggy source:
/** 
 * Prepare put.
 * @param columnFamily the column family
 * @param rowKey the row key
 * @param columns the columns
 * @param columnFamilyObj the column family obj
 * @return the put
 * @throws IOException Signals that an I/O exception has occurred.
 */
private Put preparePut(String columnFamily,Object rowKey,Map<String,Attribute> columns,Object columnFamilyObj) throws IOException {
  Put p=new Put(HBaseUtils.getBytes(rowKey));
  for (  String columnName : columns.keySet()) {
    Attribute column=columns.get(columnName);
    if (!column.isCollection() && !((SingularAttribute)column).isId()) {
      String qualifier=columnName;
      try {
        Object o=PropertyAccessorHelper.getObject(columnFamilyObj,(Field)column.getJavaMember());
        byte[] value=HBaseUtils.getBytes(o);
        if (value != null && columnFamily != null) {
          p.add(Bytes.toBytes(columnFamily),Bytes.toBytes(qualifier),value);
        }
      }
 catch (      PropertyAccessException e1) {
        throw new IOException(e1);
      }
    }
  }
  return p;
}

Fixed version (ground truth):
/** 
 * Prepare put.
 * @param columnFamily the column family
 * @param rowKey the row key
 * @param columns the columns
 * @param values TODO
 * @param columnFamilyObj the column family obj
 * @return the put
 * @throws IOException Signals that an I/O exception has occurred.
 */
private Put preparePut(String columnFamily,Object rowKey,Map<String,Attribute> columns,Map<String,Object> values) throws IOException {
  Put p=new Put(HBaseUtils.getBytes(rowKey));
  for (  String columnName : columns.keySet()) {
    Attribute column=columns.get(columnName);
    if (!column.isCollection() && !((SingularAttribute)column).isId()) {
      String qualifier=columnName;
      try {
        Object o=values.get(columnName);
        byte[] value=HBaseUtils.getBytes(o);
        if (value != null && columnFamily != null) {
          p.add(Bytes.toBytes(columnFamily),Bytes.toBytes(qualifier),value);
        }
      }
 catch (      PropertyAccessException e1) {
        throw new IOException(e1);
      }
    }
  }
  return p;
}
Program: 176318
Project: 176318
Buggy source:
/** 
 * Method to execute cql query and return back entity/enhance entities.
 * @param cqlQuery cql query to be executed.
 * @param clazz entity class.
 * @param relationalField collection for relational fields.
 * @return list of objects.
 */
@Override public List executeQuery(String cqlQuery,Class clazz,List<String> relationalField){
  return super.executeQuery(cqlQuery,clazz,relationalField,dataHandler);
}

Fixed version (ground truth):
/** 
 * Method to execute cql query and return back entity/enhance entities.
 * @param cqlQuery cql query to be executed.
 * @param clazz entity class.
 * @param relationalField collection for relational fields.
 * @return list of objects.
 */
@Override public List executeQuery(String cqlQuery,Class clazz,List<String> relationalField){
  return super.executeSelectQuery(cqlQuery,clazz,relationalField,dataHandler);
}
Program: 176319
Project: 176319
Buggy source:
/** 
 * On executeUpdate.
 * @return zero
 */
@Override protected int onExecuteUpdate(){
  EntityMetadata m=getEntityMetadata();
  if (KunderaMetadata.INSTANCE.getApplicationMetadata().isNative(getJPAQuery())) {
    ((CassandraClientBase)persistenceDelegeator.getClient(m)).executeQuery(KunderaMetadata.INSTANCE.getApplicationMetadata().getQuery(getJPAQuery()),m.getEntityClazz(),null);
  }
 else   if (kunderaQuery.isDeleteUpdate()) {
    List result=getResultList();
    return result != null ? result.size() : 0;
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * On executeUpdate.
 * @return zero
 */
@Override protected int onExecuteUpdate(){
  EntityMetadata m=getEntityMetadata();
  if (KunderaMetadata.INSTANCE.getApplicationMetadata().isNative(getJPAQuery())) {
    ((CassandraClientBase)persistenceDelegeator.getClient(m)).executeQuery(KunderaMetadata.INSTANCE.getApplicationMetadata().getQuery(getJPAQuery()),m.getEntityClazz(),null);
  }
 else   if (kunderaQuery.isDeleteUpdate()) {
    if (!isQueryConvertibleToCQL(kunderaQuery)) {
      List result=getResultList();
      return result != null ? result.size() : 0;
    }
 else {
      String query=null;
      if (kunderaQuery.isUpdateClause()) {
        query=((CassandraClientBase)persistenceDelegeator.getClient(m)).createUpdateQuery(kunderaQuery);
      }
 else {
        query=((CassandraClientBase)persistenceDelegeator.getClient(m)).createDeleteQuery(kunderaQuery);
      }
      return ((CassandraClientBase)persistenceDelegeator.getClient(m)).executeUpdateDeleteQuery(query);
    }
  }
  return 0;
}
Program: 176320
Project: 176320
Buggy source:
/** 
 * Query related methods 
 */
@Override public List executeQuery(String cqlQuery,Class clazz,List<String> relationalField){
  return super.executeQuery(cqlQuery,clazz,relationalField,dataHandler);
}

Fixed version (ground truth):
/** 
 * Query related methods 
 */
@Override public List executeQuery(String cqlQuery,Class clazz,List<String> relationalField){
  return super.executeSelectQuery(cqlQuery,clazz,relationalField,dataHandler);
}
Program: 176323
Project: 176323
Buggy source:
/** 
 * Appends a object of type   {@link java.util.List}
 * @param builder
 * @param value
 * @return
 */
private boolean appendMap(StringBuilder builder,Object value){
  boolean isPresent;
  isPresent=true;
  Map map=((Map)value);
  if (!map.isEmpty()) {
    builder.append("String_Node_Str");
    for (    Object mapKey : map.keySet()) {
      Object mapValue=map.get(mapKey);
      if (mapKey != null && mapValue != null) {
        appendValue(builder,mapKey.getClass(),mapKey);
        builder.append("String_Node_Str");
        appendValue(builder,mapValue.getClass(),mapValue);
      }
      builder.append("String_Node_Str");
    }
    builder.deleteCharAt(builder.length() - 1);
    builder.append("String_Node_Str");
  }
  return isPresent;
}

Fixed version (ground truth):
/** 
 * Appends a object of type   {@link java.util.List}
 * @param builder
 * @param value
 * @return
 */
private boolean appendMap(StringBuilder builder,Object value){
  boolean isPresent=false;
  Map map=((Map)value);
  if (!map.isEmpty()) {
    isPresent=true;
    builder.append("String_Node_Str");
    for (    Object mapKey : map.keySet()) {
      Object mapValue=map.get(mapKey);
      if (mapKey != null && mapValue != null) {
        appendValue(builder,mapKey.getClass(),mapKey);
        builder.append("String_Node_Str");
        appendValue(builder,mapValue.getClass(),mapValue);
      }
      builder.append("String_Node_Str");
    }
    builder.deleteCharAt(builder.length() - 1);
    builder.append("String_Node_Str");
  }
  return isPresent;
}
Program: 176324
Project: 176324
Buggy source:
/** 
 * Appends a object of type   {@link java.util.Map}
 * @param builder
 * @param value
 * @return
 */
private boolean appendSet(StringBuilder builder,Object value){
  boolean isPresent;
  isPresent=true;
  Collection collection=((Collection)value);
  if (!collection.isEmpty()) {
    builder.append("String_Node_Str");
    for (    Object o : collection) {
      if (o != null) {
        appendValue(builder,o.getClass(),o);
      }
      builder.append("String_Node_Str");
    }
    builder.deleteCharAt(builder.length() - 1);
    builder.append("String_Node_Str");
  }
  return isPresent;
}

Fixed version (ground truth):
/** 
 * Appends a object of type   {@link java.util.Map}
 * @param builder
 * @param value
 * @return
 */
private boolean appendSet(StringBuilder builder,Object value){
  boolean isPresent=false;
  Collection collection=((Collection)value);
  if (!collection.isEmpty()) {
    isPresent=true;
    builder.append("String_Node_Str");
    for (    Object o : collection) {
      if (o != null) {
        appendValue(builder,o.getClass(),o);
      }
      builder.append("String_Node_Str");
    }
    builder.deleteCharAt(builder.length() - 1);
    builder.append("String_Node_Str");
  }
  return isPresent;
}
Program: 176325
Project: 176325
Buggy source:
/** 
 * Appends a object of type   {@link java.util.List}
 * @param builder
 * @param value
 * @return
 */
private boolean appendList(StringBuilder builder,Object value){
  boolean isPresent;
  isPresent=true;
  Collection collection=((Collection)value);
  if (!collection.isEmpty()) {
    builder.append("String_Node_Str");
    for (    Object o : collection) {
      if (o != null) {
        appendValue(builder,o.getClass(),o);
      }
      builder.append("String_Node_Str");
    }
    builder.deleteCharAt(builder.length() - 1);
    builder.append("String_Node_Str");
  }
  return isPresent;
}

Fixed version (ground truth):
/** 
 * Appends a object of type   {@link java.util.List}
 * @param builder
 * @param value
 * @return
 */
private boolean appendList(StringBuilder builder,Object value){
  boolean isPresent=false;
  Collection collection=((Collection)value);
  if (!collection.isEmpty()) {
    isPresent=true;
    builder.append("String_Node_Str");
    for (    Object o : collection) {
      if (o != null) {
        appendValue(builder,o.getClass(),o);
      }
      builder.append("String_Node_Str");
    }
    builder.deleteCharAt(builder.length() - 1);
    builder.append("String_Node_Str");
  }
  return isPresent;
}
Program: 176326
Project: 176326
Buggy source:
/** 
 * Gets the pool config policy.
 * @param persistenceUnitMetadata the persistence unit metadata
 * @param puProperties
 * @return the pool config policy
 */
public static PoolConfiguration setPoolConfigPolicy(CassandraHost cassandraHost,PoolConfiguration prop){
  int maxActivePerNode=cassandraHost.getMaxActive();
  int maxIdlePerNode=cassandraHost.getMaxIdle();
  int minIdlePerNode=cassandraHost.getMinIdle();
  int maxTotal=cassandraHost.getMaxTotal();
  boolean testOnBorrow=cassandraHost.isTestOnBorrow();
  boolean testWhileIdle=cassandraHost.isTestWhileIdle();
  boolean testOnConnect=cassandraHost.isTestOnConnect();
  boolean testOnReturn=cassandraHost.isTestOnReturn();
  int socketTimeOut=cassandraHost.getSocketTimeOut();
  int maxWaitInMilli=cassandraHost.getMaxWait();
  HostFailoverPolicy paramHostFailoverPolicy=cassandraHost.getHostFailoverPolicy();
  if (maxActivePerNode > 0) {
    prop.setInitialSize(maxActivePerNode);
    prop.setMaxActive(maxActivePerNode);
  }
  if (maxIdlePerNode > 0) {
    prop.setMaxIdle(maxIdlePerNode);
  }
  if (minIdlePerNode > 0) {
    prop.setMinIdle(minIdlePerNode);
  }
  if (maxTotal > 0) {
    prop.setMaxActive(maxTotal);
  }
  prop.setSocketTimeout(socketTimeOut);
  prop.setTestOnBorrow(testOnBorrow);
  prop.setTestOnConnect(testOnConnect);
  prop.setTestOnReturn(testOnReturn);
  prop.setTestWhileIdle(testWhileIdle);
  prop.setFailoverPolicy(paramHostFailoverPolicy);
  prop.setMaxWait(maxWaitInMilli);
  return prop;
}

Fixed version (ground truth):
/** 
 * Gets the pool config policy.
 * @param persistenceUnitMetadata the persistence unit metadata
 * @param puProperties
 * @return the pool config policy
 */
public static PoolConfiguration setPoolConfigPolicy(CassandraHost cassandraHost,PoolConfiguration prop){
  int maxActivePerNode=cassandraHost.getMaxActive();
  int maxIdlePerNode=cassandraHost.getMaxIdle();
  int minIdlePerNode=cassandraHost.getMinIdle();
  int maxTotal=cassandraHost.getMaxTotal();
  boolean testOnBorrow=cassandraHost.isTestOnBorrow();
  boolean testWhileIdle=cassandraHost.isTestWhileIdle();
  boolean testOnConnect=cassandraHost.isTestOnConnect();
  boolean testOnReturn=cassandraHost.isTestOnReturn();
  int socketTimeOut=cassandraHost.getSocketTimeOut();
  int maxWaitInMilli=cassandraHost.getMaxWait();
  HostFailoverPolicy paramHostFailoverPolicy=cassandraHost.getHostFailoverPolicy();
  if (maxActivePerNode > 0) {
    prop.setInitialSize(maxActivePerNode);
    prop.setMaxActive(maxActivePerNode);
  }
  if (maxIdlePerNode > 0) {
    prop.setMaxIdle(maxIdlePerNode);
  }
  if (minIdlePerNode > 0) {
    prop.setMinIdle(minIdlePerNode);
  }
  if (maxTotal > 0) {
    prop.setMaxActive(maxTotal);
  }
  if (cassandraHost.getUser() != null) {
    prop.setUsername(cassandraHost.getUser());
    prop.setPassword(cassandraHost.getPassword());
  }
  prop.setSocketTimeout(socketTimeOut);
  prop.setTestOnBorrow(testOnBorrow);
  prop.setTestOnConnect(testOnConnect);
  prop.setTestOnReturn(testOnReturn);
  prop.setTestWhileIdle(testWhileIdle);
  prop.setFailoverPolicy(paramHostFailoverPolicy);
  prop.setMaxWait(maxWaitInMilli);
  return prop;
}
Program: 176328
Project: 176328
Buggy source:
/** 
 * initiate client method initiates the client.
 * @return boolean value ie client started or not.
 */
protected boolean initiateClient(){
  Throwable message=null;
  for (  String host : hosts) {
    if (host == null || !StringUtils.isNumeric(port) || port.isEmpty()) {
      log.error("String_Node_Str");
      throw new IllegalArgumentException("String_Node_Str");
    }
    TSocket socket=new TSocket(host,Integer.parseInt(port));
    TTransport transport=new TFramedTransport(socket);
    TProtocol protocol=new TBinaryProtocol(transport);
    cassandra_client=new Cassandra.Client(protocol);
    try {
      if (!socket.isOpen()) {
        socket.open();
      }
      return true;
    }
 catch (    TTransportException e) {
      message=e;
      log.warn("String_Node_Str",host);
    }
catch (    NumberFormatException e) {
      log.error("String_Node_Str",e);
      throw new SchemaGenerationException(e,"String_Node_Str");
    }
  }
  throw new SchemaGenerationException("String_Node_Str",message,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * initiate client method initiates the client.
 * @return boolean value ie client started or not.
 */
protected boolean initiateClient(){
  Throwable message=null;
  for (  String host : hosts) {
    if (host == null || !StringUtils.isNumeric(port) || port.isEmpty()) {
      log.error("String_Node_Str");
      throw new IllegalArgumentException("String_Node_Str");
    }
    TSocket socket=new TSocket(host,Integer.parseInt(port));
    TTransport transport=new TFramedTransport(socket);
    TProtocol protocol=new TBinaryProtocol(transport);
    cassandra_client=new Cassandra.Client(protocol);
    try {
      if (!socket.isOpen()) {
        socket.open();
        if (userName != null) {
          Map<String,String> credentials=new HashMap<String,String>();
          credentials.put("String_Node_Str",userName);
          credentials.put("String_Node_Str",password);
          AuthenticationRequest auth_request=new AuthenticationRequest(credentials);
          cassandra_client.login(auth_request);
        }
      }
      return true;
    }
 catch (    TTransportException e) {
      message=e;
      log.warn("String_Node_Str",host);
    }
catch (    Exception e) {
      log.error("String_Node_Str",e);
      throw new SchemaGenerationException(e,"String_Node_Str");
    }
  }
  throw new SchemaGenerationException("String_Node_Str",message,"String_Node_Str");
}
Program: 176329
Project: 176329
Buggy source:
/** 
 * @param pu
 */
private void readConfigProperties(final PersistenceUnitMetadata puMetadata){
  String hostName=null;
  String portName=null;
  String operationType=null;
  String schemaName=null;
  if (externalProperties != null) {
    portName=(String)externalProperties.get(PersistenceProperties.KUNDERA_PORT);
    hostName=(String)externalProperties.get(PersistenceProperties.KUNDERA_NODES);
    schemaName=(String)externalProperties.get(PersistenceProperties.KUNDERA_KEYSPACE);
    operationType=(String)externalProperties.get(PersistenceProperties.KUNDERA_DDL_AUTO_PREPARE);
  }
  if (portName == null)   portName=puMetadata.getProperties().getProperty(PersistenceProperties.KUNDERA_PORT);
  if (hostName == null)   hostName=puMetadata.getProperties().getProperty(PersistenceProperties.KUNDERA_NODES);
  if (schemaName == null)   schemaName=puMetadata.getProperties().getProperty(PersistenceProperties.KUNDERA_KEYSPACE);
  if (operationType == null)   operationType=puMetadata.getProperty(PersistenceProperties.KUNDERA_DDL_AUTO_PREPARE);
  String[] hostArray=hostName.split("String_Node_Str");
  hosts=new String[hostArray.length];
  for (int i=0; i < hostArray.length; i++) {
    hosts[i]=hostArray[i].trim();
  }
  this.port=portName;
  this.databaseName=schemaName;
  this.operation=operationType;
}

Fixed version (ground truth):
/** 
 * @param pu
 */
private void readConfigProperties(final PersistenceUnitMetadata puMetadata){
  String hostName=null;
  String portName=null;
  String operationType=null;
  String schemaName=null;
  if (externalProperties != null) {
    portName=(String)externalProperties.get(PersistenceProperties.KUNDERA_PORT);
    hostName=(String)externalProperties.get(PersistenceProperties.KUNDERA_NODES);
    userName=(String)externalProperties.get(PersistenceProperties.KUNDERA_USERNAME);
    password=(String)externalProperties.get(PersistenceProperties.KUNDERA_PASSWORD);
    schemaName=(String)externalProperties.get(PersistenceProperties.KUNDERA_KEYSPACE);
    operationType=(String)externalProperties.get(PersistenceProperties.KUNDERA_DDL_AUTO_PREPARE);
  }
  if (portName == null)   portName=puMetadata.getProperties().getProperty(PersistenceProperties.KUNDERA_PORT);
  if (hostName == null)   hostName=puMetadata.getProperties().getProperty(PersistenceProperties.KUNDERA_NODES);
  if (schemaName == null)   schemaName=puMetadata.getProperties().getProperty(PersistenceProperties.KUNDERA_KEYSPACE);
  if (operationType == null)   operationType=puMetadata.getProperty(PersistenceProperties.KUNDERA_DDL_AUTO_PREPARE);
  if (userName == null) {
    userName=puMetadata.getProperty(PersistenceProperties.KUNDERA_USERNAME);
    password=puMetadata.getProperty(PersistenceProperties.KUNDERA_PASSWORD);
  }
  String[] hostArray=hostName.split("String_Node_Str");
  hosts=new String[hostArray.length];
  for (int i=0; i < hostArray.length; i++) {
    hosts[i]=hostArray[i].trim();
  }
  this.port=portName;
  this.databaseName=schemaName;
  this.operation=operationType;
}
Program: 176332
Project: 176332
Buggy source:
/** 
 * @return
 */
private PhotographerUni_1_M_1_M constructPhotographer(int photographerId){
  PhotographerUni_1_M_1_M a1=new PhotographerUni_1_M_1_M();
  a1.setPhotographerId(photographerId);
  a1.setPhotographerName("String_Node_Str");
  a1.setPersonalDetail(new PersonalDetail("String_Node_Str","String_Node_Str","String_Node_Str"));
  a1.addTweet(new Tweet("String_Node_Str","String_Node_Str"));
  a1.addTweet(new Tweet("String_Node_Str","String_Node_Str"));
  a1.addTweet(new Tweet("String_Node_Str","String_Node_Str"));
  AlbumUni_1_M_1_M b11=new AlbumUni_1_M_1_M("String_Node_Str","String_Node_Str","String_Node_Str");
  AlbumUni_1_M_1_M b12=new AlbumUni_1_M_1_M("String_Node_Str","String_Node_Str","String_Node_Str");
  PhotoUni_1_M_1_M c11=new PhotoUni_1_M_1_M("String_Node_Str","String_Node_Str","String_Node_Str");
  PhotoUni_1_M_1_M c12=new PhotoUni_1_M_1_M("String_Node_Str","String_Node_Str","String_Node_Str");
  PhotoUni_1_M_1_M c13=new PhotoUni_1_M_1_M("String_Node_Str","String_Node_Str","String_Node_Str");
  PhotoUni_1_M_1_M c14=new PhotoUni_1_M_1_M("String_Node_Str","String_Node_Str","String_Node_Str");
  b11.addPhoto(c11);
  b11.addPhoto(c12);
  b12.addPhoto(c13);
  b12.addPhoto(c14);
  a1.addAlbum(b11);
  a1.addAlbum(b12);
  return a1;
}

Fixed version (ground truth):
/** 
 * @return
 */
private PhotographerUni_1_M_1_M constructPhotographer(int photographerId){
  PhotographerUni_1_M_1_M a1=new PhotographerUni_1_M_1_M();
  a1.setPhotographerId(photographerId);
  a1.setPhotographerName("String_Node_Str");
  a1.setPersonalDetail(new PersonalDetail("String_Node_Str","String_Node_Str","String_Node_Str"));
  a1.addTweet(new Tweet("String_Node_Str","String_Node_Str"));
  a1.addTweet(new Tweet("String_Node_Str","String_Node_Str"));
  a1.addTweet(new Tweet("String_Node_Str","String_Node_Str"));
  a1.addTag("String_Node_Str");
  a1.addTag("String_Node_Str");
  a1.addTag("String_Node_Str");
  a1.addLikedBy(111);
  a1.addLikedBy(222);
  a1.addComment(111,"String_Node_Str");
  a1.addComment(222,"String_Node_Str");
  a1.addComment(333,"String_Node_Str");
  AlbumUni_1_M_1_M b11=new AlbumUni_1_M_1_M("String_Node_Str","String_Node_Str","String_Node_Str");
  AlbumUni_1_M_1_M b12=new AlbumUni_1_M_1_M("String_Node_Str","String_Node_Str","String_Node_Str");
  PhotoUni_1_M_1_M c11=new PhotoUni_1_M_1_M("String_Node_Str","String_Node_Str","String_Node_Str");
  PhotoUni_1_M_1_M c12=new PhotoUni_1_M_1_M("String_Node_Str","String_Node_Str","String_Node_Str");
  PhotoUni_1_M_1_M c13=new PhotoUni_1_M_1_M("String_Node_Str","String_Node_Str","String_Node_Str");
  PhotoUni_1_M_1_M c14=new PhotoUni_1_M_1_M("String_Node_Str","String_Node_Str","String_Node_Str");
  b11.addPhoto(c11);
  b11.addPhoto(c12);
  b12.addPhoto(c13);
  b12.addPhoto(c14);
  a1.addAlbum(b11);
  a1.addAlbum(b12);
  return a1;
}
Program: 176333
Project: 176333
Buggy source:
/** 
 * Fetch data from lucene.
 * @param client the client
 * @return the sets the
 */
protected Set<String> fetchDataFromLucene(Client client){
  Map<String,Object> results=client.getIndexManager().search(luceneQueryFromJPAQuery);
  Set rSet=new HashSet(results.values());
  return rSet;
}

Fixed version (ground truth):
/** 
 * Fetch data from lucene.
 * @param client the client
 * @return the sets the
 */
protected Set<String> fetchDataFromLucene(Class<?> clazz,Client client){
  Map<String,Object> results=client.getIndexManager().search(clazz,luceneQueryFromJPAQuery);
  Set rSet=new HashSet(results.values());
  return rSet;
}
Program: 176334
Project: 176334
Buggy source:
/** 
 * On association using lucene.
 * @param m the m
 * @param client the client
 * @param ls the ls
 * @return the list
 */
protected List<EnhanceEntity> onAssociationUsingLucene(EntityMetadata m,Client client,List<EnhanceEntity> ls){
  Set<String> rSet=fetchDataFromLucene(client);
  List resultList=client.findAll(m.getEntityClazz(),null,rSet.toArray(new String[]{}));
  return m.getRelationNames() != null && !m.getRelationNames().isEmpty() ? resultList : transform(m,ls,resultList);
}

Fixed version (ground truth):
/** 
 * On association using lucene.
 * @param m the m
 * @param client the client
 * @param ls the ls
 * @return the list
 */
protected List<EnhanceEntity> onAssociationUsingLucene(EntityMetadata m,Client client,List<EnhanceEntity> ls){
  Set<String> rSet=fetchDataFromLucene(m.getEntityClazz(),client);
  List resultList=client.findAll(m.getEntityClazz(),null,rSet.toArray(new String[]{}));
  return m.getRelationNames() != null && !m.getRelationNames().isEmpty() ? resultList : transform(m,ls,resultList);
}
Program: 176335
Project: 176335
Buggy source:
/** 
 * Recursively fetches associated entities for a given <code>entity</code>
 * @param entity
 * @param relationsMap
 * @param client
 * @param m
 * @param pd
 * @return
 */
private Object handleAssociation(final Object entity,final Map<String,Object> relationsMap,final EntityMetadata m,final PersistenceDelegator pd,boolean lazilyloaded){
  for (  Relation relation : m.getRelations()) {
    ForeignKey relationType=relation.getType();
    Object relationalObject=PropertyAccessorHelper.getObject(entity,relation.getProperty());
    if (relationalObject == null || ProxyHelper.isProxyOrCollection(relationalObject)) {
      onRelation(entity,relationsMap,m,pd,relation,relationType,lazilyloaded);
    }
  }
  return entity;
}

Fixed version (ground truth):
/** 
 * Recursively fetches associated entities for a given <code>entity</code>
 * @param entity
 * @param relationsMap
 * @param client
 * @param m
 * @param pd
 * @return
 */
private Object handleAssociation(final Object entity,final Map<String,Object> relationsMap,final EntityMetadata m,final PersistenceDelegator pd,boolean lazilyloaded){
  for (  Relation relation : m.getRelations()) {
    ForeignKey relationType=relation.getType();
    Object relationalObject=PropertyAccessorHelper.getObject(entity,relation.getProperty());
    if (KunderaCoreUtils.isEmptyOrNull(relationalObject) || ProxyHelper.isProxyOrCollection(relationalObject)) {
      onRelation(entity,relationsMap,m,pd,relation,relationType,lazilyloaded);
    }
  }
  return entity;
}
Program: 176339
Project: 176339
Buggy source:
private void onassertBi1MAssociation(PersistenceDelegator delegator){
  KunderaQuery kunderaQuery;
  CoreQuery queryObj;
  PersonB1M personBi1M=new PersonB1M();
  personBi1M.setPersonId("String_Node_Str");
  personBi1M.setPersonName("String_Node_Str");
  AddressB1M addressBi1M=new AddressB1M();
  addressBi1M.setAddressId("String_Node_Str");
  addressBi1M.setStreet("String_Node_Str");
  Set<AddressB1M> addresses=new HashSet<AddressB1M>();
  addresses.add(addressBi1M);
  AddressB1M addressBi1M_copy=new AddressB1M();
  addressBi1M_copy.setAddressId("String_Node_Str");
  addressBi1M_copy.setStreet("String_Node_Str");
  addresses.add(addressBi1M_copy);
  personBi1M.setAddresses(addresses);
  em.persist(personBi1M);
  em.clear();
  String selectAssociationQuery="String_Node_Str";
  kunderaQuery=parseQuery(selectAssociationQuery);
  queryObj=new CoreQuery(selectAssociationQuery,kunderaQuery,delegator);
  List<PersonB1M> associationResults=queryObj.getResultList();
  Assert.assertTrue(!associationResults.isEmpty());
  Assert.assertNotNull(associationResults.get(0).getAddresses());
  Assert.assertEquals(2,associationResults.get(0).getAddresses().size());
  selectAssociationQuery="String_Node_Str";
  kunderaQuery=parseQuery(selectAssociationQuery);
  queryObj=new CoreQuery(selectAssociationQuery,kunderaQuery,delegator);
  associationResults=queryObj.getResultList();
  Assert.assertTrue(associationResults.isEmpty());
}

Fixed version (ground truth):
private void onassertBi1MAssociation(PersistenceDelegator delegator){
  KunderaQuery kunderaQuery;
  CoreQuery queryObj;
  PersonB1M personBi1M=new PersonB1M();
  personBi1M.setPersonId("String_Node_Str");
  personBi1M.setPersonName("String_Node_Str");
  AddressB1M addressBi1M=new AddressB1M();
  addressBi1M.setAddressId("String_Node_Str");
  addressBi1M.setStreet("String_Node_Str");
  Set<AddressB1M> addresses=new HashSet<AddressB1M>();
  addresses.add(addressBi1M);
  AddressB1M addressBi1M_copy=new AddressB1M();
  addressBi1M_copy.setAddressId("String_Node_Str");
  addressBi1M_copy.setStreet("String_Node_Str");
  addresses.add(addressBi1M_copy);
  personBi1M.setAddresses(addresses);
  em.persist(personBi1M);
  em.clear();
  String query="String_Node_Str";
  kunderaQuery=parseQuery(query);
  queryObj=new CoreQuery(query,kunderaQuery,delegator);
  List<PersonB1M> associationResults=queryObj.getResultList();
  Assert.assertTrue(!associationResults.isEmpty());
  Assert.assertNotNull(associationResults.get(0).getAddresses());
  Assert.assertEquals(2,associationResults.get(0).getAddresses().size());
  query="String_Node_Str";
  kunderaQuery=parseQuery(query);
  queryObj=new CoreQuery(query,kunderaQuery,delegator);
  associationResults=queryObj.getResultList();
  Assert.assertTrue(associationResults.isEmpty());
}