nus-yam/ex-repair huggingface dataset:
Program: 176737
Project: 176737
Buggy source:
/** 
 * Retrieving connection from connection pool.
 * @return returns jedis instance.
 */
Jedis getConnection(){
  logger.info("String_Node_Str");
  Object poolOrConnection=getConnectionPoolOrConnection();
  if (poolOrConnection instanceof JedisPoolConfig) {
    connection=((JedisPool)getConnectionPoolOrConnection()).getResource();
    Map props=RedisPropertyReader.rsmd.getProperties();
    if (props != null) {
      for (      Object key : props.keySet()) {
        connection.configSet(key.toString(),props.get(key).toString());
      }
    }
    return connection;
  }
 else {
    return (Jedis)poolOrConnection;
  }
}

Fixed version (ground truth):
/** 
 * Retrieving connection from connection pool.
 * @return returns jedis instance.
 */
Jedis getConnection(){
  logger.info("String_Node_Str");
  Object poolOrConnection=getConnectionPoolOrConnection();
  if (poolOrConnection instanceof JedisPool) {
    connection=((JedisPool)getConnectionPoolOrConnection()).getResource();
    Map props=RedisPropertyReader.rsmd.getProperties();
    if (props != null) {
      for (      Object key : props.keySet()) {
        connection.configSet(key.toString(),props.get(key).toString());
      }
    }
    return connection;
  }
 else {
    return (Jedis)poolOrConnection;
  }
}
Program: 176738
Project: 176738
Buggy source:
/** 
 * On flusing join table data
 */
private void flushJoinTableData(){
  if (applyFlush()) {
    Map<String,JoinTableData> joinTableDataMap=flushManager.getJoinTableDataMap();
    for (    JoinTableData jtData : joinTableDataMap.values()) {
      if (!jtData.isProcessed()) {
        EntityMetadata m=KunderaMetadataManager.getEntityMetadata(jtData.getEntityClass());
        Client client=getClient(m);
        if (OPERATION.INSERT.equals(jtData.getOperation())) {
          client.persistJoinTable(jtData);
          jtData.setProcessed(true);
        }
 else         if (OPERATION.DELETE.equals(jtData.getOperation())) {
          for (          Object pk : jtData.getJoinTableRecords().keySet()) {
            client.deleteByColumn(jtData.getSchemaName(),jtData.getJoinTableName(),((AbstractAttribute)m.getIdAttribute()).getJPAColumnName(),pk);
          }
          jtData.setProcessed(true);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * On flusing join table data
 */
private void flushJoinTableData(){
  if (applyFlush()) {
    for (    JoinTableData jtData : flushManager.getJoinTableData()) {
      if (!jtData.isProcessed()) {
        EntityMetadata m=KunderaMetadataManager.getEntityMetadata(jtData.getEntityClass());
        Client client=getClient(m);
        if (OPERATION.INSERT.equals(jtData.getOperation())) {
          client.persistJoinTable(jtData);
          jtData.setProcessed(true);
        }
 else         if (OPERATION.DELETE.equals(jtData.getOperation())) {
          for (          Object pk : jtData.getJoinTableRecords().keySet()) {
            client.deleteByColumn(jtData.getSchemaName(),jtData.getJoinTableName(),((AbstractAttribute)m.getIdAttribute()).getJPAColumnName(),pk);
          }
          jtData.setProcessed(true);
        }
      }
    }
  }
}
Program: 176740
Project: 176740
Buggy source:
/** 
 * Instantiates a new flush manager.
 */
public FlushManager(){
  flushStack=new FlushStack();
  joinTableDataMap=new HashMap<String,JoinTableData>();
}

Fixed version (ground truth):
/** 
 * Instantiates a new flush manager.
 */
public FlushManager(){
  flushStack=new FlushStack();
}
Program: 176741
Project: 176741
Buggy source:
/** 
 * Empties Flush stack present in a PersistenceCache.
 */
public void clearFlushStack(){
  if (flushStack != null && !flushStack.isEmpty()) {
    flushStack.clear();
  }
  if (joinTableDataMap != null && !joinTableDataMap.isEmpty()) {
    joinTableDataMap.clear();
  }
  if (eventLogQueue != null) {
    eventLogQueue.clear();
  }
}

Fixed version (ground truth):
/** 
 * Empties Flush stack present in a PersistenceCache.
 */
public void clearFlushStack(){
  if (flushStack != null && !flushStack.isEmpty()) {
    flushStack.clear();
  }
  if (joinTableDataCollection != null && !joinTableDataCollection.isEmpty()) {
    joinTableDataCollection.clear();
  }
  if (eventLogQueue != null) {
    eventLogQueue.clear();
  }
}
Program: 176742
Project: 176742
Buggy source:
private void rollbackJoinTableData(PersistenceDelegator delegator){
  Map<String,JoinTableData> joinTableDataMap=getJoinTableDataMap();
  for (  JoinTableData jtData : joinTableDataMap.values()) {
    if (jtData.isProcessed()) {
      EntityMetadata m=KunderaMetadataManager.getEntityMetadata(jtData.getEntityClass());
      Client client=delegator.getClient(m);
      if (OPERATION.INSERT.equals(jtData.getOperation())) {
        for (        Object pk : jtData.getJoinTableRecords().keySet()) {
          client.deleteByColumn(jtData.getSchemaName(),jtData.getJoinTableName(),m.getIdAttribute().getName(),pk);
        }
      }
 else       if (OPERATION.DELETE.equals(jtData.getOperation())) {
        client.persistJoinTable(jtData);
      }
    }
  }
  joinTableDataMap.clear();
  joinTableDataMap=null;
  joinTableDataMap=new HashMap<String,JoinTableData>();
}

Fixed version (ground truth):
private void rollbackJoinTableData(PersistenceDelegator delegator){
  for (  JoinTableData jtData : joinTableDataCollection) {
    if (jtData.isProcessed()) {
      EntityMetadata m=KunderaMetadataManager.getEntityMetadata(jtData.getEntityClass());
      Client client=delegator.getClient(m);
      if (OPERATION.INSERT.equals(jtData.getOperation())) {
        for (        Object pk : jtData.getJoinTableRecords().keySet()) {
          client.deleteByColumn(jtData.getSchemaName(),jtData.getJoinTableName(),m.getIdAttribute().getName(),pk);
        }
      }
 else       if (OPERATION.DELETE.equals(jtData.getOperation())) {
        client.persistJoinTable(jtData);
      }
    }
  }
  joinTableDataCollection.clear();
  joinTableDataCollection=null;
  joinTableDataCollection=new ArrayList<JoinTableData>();
}
Program: 176743
Project: 176743
Buggy source:
/** 
 * Finds ands returns Entity metadata for a given array of PUs.
 * @param entityClass the entity class
 * @param persistenceUnits the persistence units
 * @return the entity metadata
 */
public static EntityMetadata getEntityMetadata(Class entityClass){
  List<String> persistenceUnits=KunderaMetadata.INSTANCE.getApplicationMetadata().getMappedPersistenceUnit(entityClass);
  if (persistenceUnits != null) {
    for (    String pu : persistenceUnits) {
      MetamodelImpl metamodel=getMetamodel(pu);
      EntityMetadata metadata=metamodel.getEntityMetadata(entityClass);
      if (metadata != null && metadata.getPersistenceUnit().equals(pu)) {
        return metadata;
      }
    }
  }
  log.warn("String_Node_Str" + entityClass + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  return null;
}

Fixed version (ground truth):
/** 
 * Finds ands returns Entity metadata for a given array of PUs.
 * @param entityClass the entity class
 * @param persistenceUnits the persistence units
 * @return the entity metadata
 */
public static EntityMetadata getEntityMetadata(Class entityClass){
  List<String> persistenceUnits=KunderaMetadata.INSTANCE.getApplicationMetadata().getMappedPersistenceUnit(entityClass);
  if (persistenceUnits != null) {
    for (    String pu : persistenceUnits) {
      MetamodelImpl metamodel=getMetamodel(pu);
      EntityMetadata metadata=metamodel.getEntityMetadata(entityClass);
      if (metadata != null && metadata.getPersistenceUnit().equals(pu)) {
        return metadata;
      }
    }
  }
  if (log.isDebugEnabled())   log.warn("String_Node_Str" + entityClass + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  return null;
}
Program: 176745
Project: 176745
Buggy source:
/** 
 * Writes an entity into Persistence cache. (Actual database write is done while flushing)
 */
public void persist(Object e){
  if (!validator.isValidEntityObject(e)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  EntityMetadata metadata=getMetadata(e.getClass());
  getEventDispatcher().fireEventListeners(metadata,e,PrePersist.class);
  ObjectGraph graph=graphBuilder.getObjectGraph(e,new TransientState());
  Node node=graph.getHeadNode();
  lock.writeLock().lock();
  node.persist();
  if (node.isHeadNode()) {
    flushManager.buildFlushStack(node,com.impetus.kundera.persistence.context.EventLog.EventType.INSERT);
    flush();
    getPersistenceCache().getMainCache().addHeadNode(node);
  }
  lock.writeLock().unlock();
  graph.clear();
  graph=null;
  getEventDispatcher().fireEventListeners(metadata,e,PostPersist.class);
  log.debug("String_Node_Str" + e.getClass());
}

Fixed version (ground truth):
/** 
 * Writes an entity into Persistence cache. (Actual database write is done while flushing)
 */
public void persist(Object e){
  if (!validator.isValidEntityObject(e)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  EntityMetadata metadata=getMetadata(e.getClass());
  getEventDispatcher().fireEventListeners(metadata,e,PrePersist.class);
  ObjectGraph graph=graphBuilder.getObjectGraph(e,new TransientState());
  Node node=graph.getHeadNode();
  lock.writeLock().lock();
  node.persist();
  if (node.isHeadNode()) {
    flushManager.buildFlushStack(node,com.impetus.kundera.persistence.context.EventLog.EventType.INSERT);
    flush();
    getPersistenceCache().getMainCache().addHeadNode(node);
  }
  lock.writeLock().unlock();
  graph.clear();
  graph=null;
  getEventDispatcher().fireEventListeners(metadata,e,PostPersist.class);
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + e.getClass());
  }
}
Program: 176746
Project: 176746
Buggy source:
private void logCacheEvent(String eventType,String nodeId){
  log.debug("String_Node_Str" + nodeId + "String_Node_Str"+ eventType+ "String_Node_Str");
}

Fixed version (ground truth):
private void logCacheEvent(String eventType,String nodeId){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + nodeId + "String_Node_Str"+ eventType+ "String_Node_Str");
  }
}
Program: 176748
Project: 176748
Buggy source:
/** 
 * On column.
 * @param column the column
 * @param m the m
 * @param entity the entity
 * @param entityType the entity type
 * @param relationNames the relation names
 * @param isWrapReq the is wrap req
 * @param relations the relations
 */
private void onColumn(Column column,EntityMetadata m,Object entity,EntityType entityType,List<String> relationNames,boolean isWrapReq,Map<String,Object> relations){
  MetamodelImpl metaModel=(MetamodelImpl)KunderaMetadata.INSTANCE.getApplicationMetadata().getMetamodel(m.getPersistenceUnit());
  String thriftColumnName=PropertyAccessorFactory.STRING.fromBytes(String.class,column.getName());
  byte[] thriftColumnValue=column.getValue();
  populateViaThrift(m,entity,entityType,relationNames,relations,thriftColumnName,thriftColumnValue);
}

Fixed version (ground truth):
/** 
 * On column.
 * @param column the column
 * @param m the m
 * @param entity the entity
 * @param entityType the entity type
 * @param relationNames the relation names
 * @param isWrapReq the is wrap req
 * @param relations the relations
 * @throws IllegalAccessException
 * @throws InstantiationException
 */
private Object onColumn(Column column,EntityMetadata m,Object entity,EntityType entityType,List<String> relationNames,boolean isWrapReq,Map<String,Object> relations) throws InstantiationException, IllegalAccessException {
  MetamodelImpl metaModel=(MetamodelImpl)KunderaMetadata.INSTANCE.getApplicationMetadata().getMetamodel(m.getPersistenceUnit());
  String thriftColumnName=PropertyAccessorFactory.STRING.fromBytes(String.class,column.getName());
  byte[] thriftColumnValue=column.getValue();
  return populateViaThrift(m,entity,entityType,relationNames,relations,thriftColumnName,thriftColumnValue);
}
Program: 176749
Project: 176749
Buggy source:
/** 
 * On counter column.
 * @param column the column
 * @param m the m
 * @param entity the entity
 * @param entityType the entity type
 * @param relationNames the relation names
 * @param isWrapReq the is wrap req
 * @param relations the relations
 */
private void onCounterColumn(CounterColumn column,EntityMetadata m,Object entity,EntityType entityType,List<String> relationNames,boolean isWrapReq,Map<String,Object> relations){
  String thriftColumnName=PropertyAccessorFactory.STRING.fromBytes(String.class,column.getName());
  String thriftColumnValue=new Long(column.getValue()).toString();
  populateViaThrift(m,entity,entityType,relationNames,relations,thriftColumnName,thriftColumnValue);
}

Fixed version (ground truth):
/** 
 * On counter column.
 * @param column the column
 * @param m the m
 * @param entity the entity
 * @param entityType the entity type
 * @param relationNames the relation names
 * @param isWrapReq the is wrap req
 * @param relations the relations
 * @throws IllegalAccessException
 * @throws InstantiationException
 */
private void onCounterColumn(CounterColumn column,EntityMetadata m,Object entity,EntityType entityType,List<String> relationNames,boolean isWrapReq,Map<String,Object> relations) throws InstantiationException, IllegalAccessException {
  String thriftColumnName=PropertyAccessorFactory.STRING.fromBytes(String.class,column.getName());
  String thriftColumnValue=new Long(column.getValue()).toString();
  populateViaThrift(m,entity,entityType,relationNames,relations,thriftColumnName,thriftColumnValue);
}
Program: 176751
Project: 176751
Buggy source:
/** 
 * Initialize.
 * @param tr the tr
 * @param m the m
 * @param entity the entity
 * @return the object
 * @throws InstantiationException the instantiation exception
 * @throws IllegalAccessException the illegal access exception
 */
private Object initialize(ThriftRow tr,EntityMetadata m,Object entity) throws InstantiationException, IllegalAccessException {
  if (entity == null) {
    entity=m.getEntityClazz().newInstance();
    PropertyAccessorHelper.setId(entity,m,tr.getId());
  }
  return entity;
}

Fixed version (ground truth):
/** 
 * Initialize.
 * @param tr the tr
 * @param m the m
 * @param entity the entity
 * @param tr
 * @return the object
 * @throws InstantiationException the instantiation exception
 * @throws IllegalAccessException the illegal access exception
 */
private Object initialize(EntityMetadata m,Object entity,Object id) throws InstantiationException, IllegalAccessException {
  if (entity == null) {
    entity=m.getEntityClazz().newInstance();
    if (id != null) {
      PropertyAccessorHelper.setId(entity,m,id);
    }
  }
  return entity;
}
Program: 176752
Project: 176752
Buggy source:
@Test public void test() throws TException, InvalidRequestException, UnavailableException, TimedOutException, SchemaDisagreementException {
  init();
  em.clear();
  findById();
  findByWithOutWhereClause();
  findByIdEQ();
  findByIdLT();
  findByIdLTE();
  findByIdGT();
  findByIdGTE();
  findByIdGTEAndLT();
  findByIdGTAndLTE();
  findByIdGTAndAgeGTAndLT();
  findByIdGTEAndAge();
  findByIdLTEAndAge();
}

Fixed version (ground truth):
@Test public void test() throws TException, InvalidRequestException, UnavailableException, TimedOutException, SchemaDisagreementException {
  init();
  em.clear();
  findById();
  findByWithOutWhereClause();
  findByIdEQ();
  findByIdLT();
  findByIdLTE();
  findByIdGT();
  findByIdGTE();
  findByIdGTEAndLT();
  findByIdGTAndLTE();
  findByIdAndAgeGTAndLT();
  findByIdGTAndAgeGTAndLT();
  findByIdAndAge();
  findByIdAndAgeGT();
  findByIdGTEAndAge();
  findByIdLTEAndAge();
}
Program: 176753
Project: 176753
Buggy source:
private void onLookUp(PersistenceUnitTransactionType transactionType){
  if (transactionType != null && transactionType.equals(PersistenceUnitTransactionType.JTA)) {
    Context ctx;
    try {
      ctx=new InitialContext();
      utx=(KunderaJTAUserTransaction)ctx.lookup("String_Node_Str");
      if (utx == null) {
        throw new KunderaException("String_Node_Str");
      }
      if (!(utx instanceof KunderaJTAUserTransaction)) {
        throw new KunderaException("String_Node_Str" + KunderaJTAUserTransaction.class.getName() + "String_Node_Str"+ utx.getClass());
      }
      this.setFlushMode(FlushModeType.COMMIT);
      ((KunderaJTAUserTransaction)utx).setImplementor(this);
    }
 catch (    NamingException e) {
      logger.error("String_Node_Str" + e.getMessage());
      throw new KunderaException(e);
    }
  }
}

Fixed version (ground truth):
private void onLookUp(PersistenceUnitTransactionType transactionType){
  if (transactionType != null && transactionType.equals(PersistenceUnitTransactionType.JTA)) {
    Context ctx;
    try {
      ctx=new InitialContext();
      utx=(KunderaJTAUserTransaction)ctx.lookup("String_Node_Str");
      if (utx == null) {
        throw new KunderaException("String_Node_Str");
      }
      if (!(utx instanceof KunderaJTAUserTransaction)) {
        throw new KunderaException("String_Node_Str" + KunderaJTAUserTransaction.class.getName() + "String_Node_Str"+ utx.getClass());
      }
      if (((KunderaJTAUserTransaction)utx).isTransactionInProgress()) {
        entityTransaction.begin();
      }
      this.setFlushMode(FlushModeType.COMMIT);
      ((KunderaJTAUserTransaction)utx).setImplementor(this);
    }
 catch (    NamingException e) {
      logger.error("String_Node_Str" + e.getMessage());
      throw new KunderaException(e);
    }
  }
}
Program: 176754
Project: 176754
Buggy source:
@Override protected Object createPoolOrConnection(){
  PersistenceUnitMetadata persistenceUnitMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata().getPersistenceUnitMetadata(getPersistenceUnit());
  Properties props=persistenceUnitMetadata.getProperties();
  String contactNodes=null;
  String defaultPort=null;
  String keyspace=null;
  if (externalProperties != null) {
    contactNodes=(String)externalProperties.get(PersistenceProperties.KUNDERA_NODES);
    defaultPort=(String)externalProperties.get(PersistenceProperties.KUNDERA_PORT);
    keyspace=(String)externalProperties.get(PersistenceProperties.KUNDERA_KEYSPACE);
  }
  if (contactNodes == null) {
    contactNodes=(String)props.get(PersistenceProperties.KUNDERA_NODES);
  }
  if (defaultPort == null) {
    defaultPort=(String)props.get(PersistenceProperties.KUNDERA_PORT);
  }
  if (keyspace == null) {
    keyspace=(String)props.get(PersistenceProperties.KUNDERA_KEYSPACE);
  }
  PoolConfiguration prop=new PoolProperties();
  prop.setHost(contactNodes);
  prop.setPort(Integer.parseInt(defaultPort));
  prop.setKeySpace(keyspace);
  PelopsUtils.setPoolConfigPolicy(persistenceUnitMetadata,prop,externalProperties);
  try {
    pool=new ConnectionPool(prop);
  }
 catch (  TException e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
@Override protected Object createPoolOrConnection(){
  PersistenceUnitMetadata persistenceUnitMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata().getPersistenceUnitMetadata(getPersistenceUnit());
  Properties props=persistenceUnitMetadata.getProperties();
  String contactNodes=null;
  String defaultPort=null;
  String keyspace=null;
  if (externalProperties != null) {
    contactNodes=(String)externalProperties.get(PersistenceProperties.KUNDERA_NODES);
    defaultPort=(String)externalProperties.get(PersistenceProperties.KUNDERA_PORT);
    keyspace=(String)externalProperties.get(PersistenceProperties.KUNDERA_KEYSPACE);
  }
  if (contactNodes == null) {
    contactNodes=(String)props.get(PersistenceProperties.KUNDERA_NODES);
  }
  if (defaultPort == null) {
    defaultPort=(String)props.get(PersistenceProperties.KUNDERA_PORT);
  }
  if (keyspace == null) {
    keyspace=(String)props.get(PersistenceProperties.KUNDERA_KEYSPACE);
  }
  PoolConfiguration prop=new PoolProperties();
  prop.setHost(contactNodes);
  prop.setPort(Integer.parseInt(defaultPort));
  prop.setKeySpace(keyspace);
  PelopsUtils.setPoolConfigPolicy(persistenceUnitMetadata,prop,externalProperties);
  try {
    pool=new ConnectionPool(prop);
  }
 catch (  TException e) {
    logger.error("String_Node_Str",e);
    throw new ClientLoaderException(e);
  }
  return null;
}
Program: 176755
Project: 176755
Buggy source:
@Override public synchronized final EntityManagerFactory createEntityManagerFactory(String persistenceUnit,Map map){
synchronized (persistenceUnit) {
    initializeKundera(persistenceUnit,map);
    EntityManagerFactory emf=new EntityManagerFactoryImpl(persistenceUnit,map);
    return emf;
  }
}

Fixed version (ground truth):
@Override public synchronized final EntityManagerFactory createEntityManagerFactory(String persistenceUnit,Map map){
synchronized (persistenceUnit) {
    try {
      initializeKundera(persistenceUnit,map);
      EntityManagerFactory emf=new EntityManagerFactoryImpl(persistenceUnit,map);
      return emf;
    }
 catch (    PersistenceUnitConfigurationException pcex) {
      return null;
    }
  }
}
Program: 176756
Project: 176756
Buggy source:
@Override public void configure(){
  log.info("String_Node_Str");
  KunderaMetadata kunderaMetadata=KunderaMetadata.INSTANCE;
  ApplicationMetadata appMetadata=kunderaMetadata.getApplicationMetadata();
  Map<String,PersistenceUnitMetadata> metadatas;
  try {
    metadatas=findPersistenceMetadatas();
    for (    String persistenceUnit : persistenceUnits) {
      if (!metadatas.containsKey(persistenceUnit)) {
        log.error("String_Node_Str" + persistenceUnit + "String_Node_Str");
        throw new IllegalArgumentException("String_Node_Str" + persistenceUnit + "String_Node_Str");
      }
    }
    log.info("String_Node_Str");
    appMetadata.addPersistenceUnitMetadata(metadatas);
  }
 catch (  InvalidConfigurationException icex) {
    log.error("String_Node_Str" + icex.getMessage());
    throw new PersistenceLoaderException(icex);
  }
}

Fixed version (ground truth):
@Override public void configure(){
  log.info("String_Node_Str");
  KunderaMetadata kunderaMetadata=KunderaMetadata.INSTANCE;
  ApplicationMetadata appMetadata=kunderaMetadata.getApplicationMetadata();
  Map<String,PersistenceUnitMetadata> metadatas;
  try {
    metadatas=findPersistenceMetadatas();
    for (    String persistenceUnit : persistenceUnits) {
      if (!metadatas.containsKey(persistenceUnit)) {
        log.error("String_Node_Str" + persistenceUnit + "String_Node_Str");
        throw new PersistenceUnitConfigurationException("String_Node_Str" + persistenceUnit + "String_Node_Str");
      }
    }
    log.info("String_Node_Str");
    appMetadata.addPersistenceUnitMetadata(metadatas);
  }
 catch (  InvalidConfigurationException icex) {
    log.error("String_Node_Str" + icex.getMessage());
    throw new PersistenceLoaderException(icex);
  }
}
Program: 176757
Project: 176757
Buggy source:
/** 
 * Test invalid configure.
 */
@Test public void testInvalidConfigure(){
  final String invalidPuName="String_Node_Str";
  PersistenceUnitMetadata puMetadata=null;
  try {
    Configurator configurator=new Configurator(null,invalidPuName);
    configurator.configure();
    puMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata().getPersistenceUnitMetadata(invalidPuName);
  }
 catch (  IllegalArgumentException iex) {
    Assert.assertNull(puMetadata);
  }
}

Fixed version (ground truth):
/** 
 * Test invalid configure.
 */
@Test public void testInvalidConfigure(){
  final String invalidPuName="String_Node_Str";
  PersistenceUnitMetadata puMetadata=null;
  try {
    Configurator configurator=new Configurator(null,invalidPuName);
    configurator.configure();
    puMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata().getPersistenceUnitMetadata(invalidPuName);
  }
 catch (  PersistenceUnitConfigurationException iex) {
    Assert.assertNull(puMetadata);
  }
}
Program: 176761
Project: 176761
Buggy source:
/** 
 * create method creates schema and table for the list of tableInfos.
 * @param tableInfos list of TableInfos.
 */
protected void create(List<TableInfo> tableInfos){
  for (  TableInfo tableInfo : tableInfos) {
    try {
      admin.getTableDescriptor(tableInfo.getTableName().getBytes());
      admin.disableTable(tableInfo.getTableName());
      admin.deleteTable(tableInfo.getTableName());
    }
 catch (    TableNotFoundException e) {
      logger.info("String_Node_Str" + tableInfo.getTableName());
    }
catch (    IOException ioex) {
      logger.error("String_Node_Str" + ioex.getMessage());
      throw new SchemaGenerationException(ioex,"String_Node_Str");
    }
    HTableDescriptor hTableDescriptor=getTableMetaData(tableInfo);
    try {
      admin.createTable(hTableDescriptor);
    }
 catch (    IOException ioex1) {
      logger.error("String_Node_Str" + ioex1.getMessage());
      throw new SchemaGenerationException(ioex1,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * create method creates schema and table for the list of tableInfos.
 * @param tableInfos list of TableInfos.
 */
protected void create(List<TableInfo> tableInfos){
  for (  TableInfo tableInfo : tableInfos) {
    if (tableInfo != null && tableInfo.getTableName() != null) {
      try {
        admin.getTableDescriptor(tableInfo.getTableName().getBytes());
        admin.disableTable(tableInfo.getTableName());
        admin.deleteTable(tableInfo.getTableName());
      }
 catch (      TableNotFoundException e) {
        logger.info("String_Node_Str" + tableInfo.getTableName());
      }
catch (      IOException ioex) {
        logger.error("String_Node_Str" + ioex.getMessage());
        throw new SchemaGenerationException(ioex,"String_Node_Str");
      }
      HTableDescriptor hTableDescriptor=getTableMetaData(tableInfo);
      try {
        admin.createTable(hTableDescriptor);
      }
 catch (      IOException ioex1) {
        logger.error("String_Node_Str" + ioex1.getMessage());
        throw new SchemaGenerationException(ioex1,"String_Node_Str");
      }
    }
  }
}
Program: 176762
Project: 176762
Buggy source:
/** 
 * drop schema method drop the table
 */
public void dropSchema(){
  if (operation != null && operation.equalsIgnoreCase("String_Node_Str")) {
    for (    TableInfo tableInfo : tableInfos) {
      try {
        admin.disableTable(tableInfo.getTableName());
        admin.deleteTable(tableInfo.getTableName());
      }
 catch (      TableNotFoundException e) {
        logger.error("String_Node_Str" + e.getMessage());
        throw new SchemaGenerationException(e,"String_Node_Str");
      }
catch (      IOException e) {
        logger.error("String_Node_Str" + e.getMessage());
        throw new SchemaGenerationException(e,"String_Node_Str");
      }
    }
  }
  operation=null;
  admin=null;
}

Fixed version (ground truth):
/** 
 * drop schema method drop the table
 */
public void dropSchema(){
  if (operation != null && operation.equalsIgnoreCase("String_Node_Str")) {
    for (    TableInfo tableInfo : tableInfos) {
      if (tableInfo != null && tableInfo.getTableName() != null) {
        try {
          admin.disableTable(tableInfo.getTableName());
          admin.deleteTable(tableInfo.getTableName());
        }
 catch (        TableNotFoundException e) {
          logger.error("String_Node_Str" + e.getMessage());
          throw new SchemaGenerationException(e,"String_Node_Str");
        }
catch (        IOException e) {
          logger.error("String_Node_Str" + e.getMessage());
          throw new SchemaGenerationException(e,"String_Node_Str");
        }
      }
    }
  }
  operation=null;
  admin=null;
}
Program: 176763
Project: 176763
Buggy source:
/** 
 * add tables to given keyspace   {@code ksDef}.
 * @param tableInfos the table infos
 * @param ksDef the ks def
 * @throws InvalidRequestException the invalid request exception
 * @throws SchemaDisagreementException the schema disagreement exception
 * @throws TException the t exception
 * @throws InterruptedException the interrupted exception
 */
private void addTablesToKeyspace(List<TableInfo> tableInfos,KsDef ksDef) throws InvalidRequestException, SchemaDisagreementException, TException, InterruptedException {
  cassandra_client.set_keyspace(databaseName);
  for (  TableInfo tableInfo : tableInfos) {
    for (    CfDef cfDef : ksDef.getCf_defs()) {
      if (cfDef.getName().equalsIgnoreCase(tableInfo.getTableName())) {
        cassandra_client.system_drop_column_family(tableInfo.getTableName());
        dropInvertedIndexTable(tableInfo);
        TimeUnit.SECONDS.sleep(3);
        break;
      }
    }
    if (tableInfo.getTableIdType() != null && tableInfo.getTableIdType().isAnnotationPresent(Embeddable.class)) {
      if (tableInfo.getType() != null && tableInfo.getType().equals(Type.SUPER_COLUMN_FAMILY.name())) {
        throw new SchemaGenerationException("String_Node_Str","String_Node_Str",databaseName);
      }
 else {
        onCompoundKey(tableInfo);
      }
    }
 else {
      cassandra_client.system_add_column_family(getTableMetadata(tableInfo));
      createInvertedIndexTable(tableInfo);
    }
  }
}

Fixed version (ground truth):
/** 
 * add tables to given keyspace   {@code ksDef}.
 * @param tableInfos the table infos
 * @param ksDef the ks def
 * @throws InvalidRequestException the invalid request exception
 * @throws SchemaDisagreementException the schema disagreement exception
 * @throws TException the t exception
 * @throws InterruptedException the interrupted exception
 */
private void addTablesToKeyspace(List<TableInfo> tableInfos,KsDef ksDef) throws InvalidRequestException, SchemaDisagreementException, TException, InterruptedException {
  cassandra_client.set_keyspace(databaseName);
  for (  TableInfo tableInfo : tableInfos) {
    for (    CfDef cfDef : ksDef.getCf_defs()) {
      if (cfDef.getName().equalsIgnoreCase(tableInfo.getTableName())) {
        cassandra_client.system_drop_column_family(tableInfo.getTableName());
        dropInvertedIndexTable(tableInfo);
        TimeUnit.SECONDS.sleep(2);
        break;
      }
    }
    if (tableInfo.getTableIdType() != null && tableInfo.getTableIdType().isAnnotationPresent(Embeddable.class)) {
      if (tableInfo.getType() != null && tableInfo.getType().equals(Type.SUPER_COLUMN_FAMILY.name())) {
        throw new SchemaGenerationException("String_Node_Str","String_Node_Str",databaseName);
      }
 else {
        onCompoundKey(tableInfo);
      }
    }
 else {
      cassandra_client.system_add_column_family(getTableMetadata(tableInfo));
      createInvertedIndexTable(tableInfo);
    }
  }
}
Program: 176764
Project: 176764
Buggy source:
@Test public void onBatchInsert(){
  EntityManager em=emf.createEntityManager();
  UUID timeLineId=UUID.randomUUID();
  long t1=System.currentTimeMillis();
  for (int i=0; i < 5000; i++) {
    CassandraCompoundKey key=new CassandraCompoundKey("String_Node_Str",i,timeLineId);
    Map<String,Client> clients=(Map<String,Client>)em.getDelegate();
    Client client=clients.get(PERSISTENCE_UNIT);
    ((CassandraClientBase)client).setCqlVersion(CassandraConstants.CQL_VERSION_3_0);
    CassandraPrimeUser user=new CassandraPrimeUser(key);
    user.setTweetBody("String_Node_Str");
    user.setTweetDate(currentDate);
    em.persist(user);
  }
  long t2=System.currentTimeMillis();
  System.out.println("String_Node_Str" + (t2 - t1));
}

Fixed version (ground truth):
@Test public void onBatchInsert(){
  EntityManager em=emf.createEntityManager();
  UUID timeLineId=UUID.randomUUID();
  long t1=System.currentTimeMillis();
  for (int i=0; i < 5000; i++) {
    CassandraCompoundKey key=new CassandraCompoundKey("String_Node_Str",i,timeLineId);
    Map<String,Client> clients=(Map<String,Client>)em.getDelegate();
    Client client=clients.get(PERSISTENCE_UNIT);
    ((CassandraClientBase)client).setCqlVersion(CassandraConstants.CQL_VERSION_3_0);
    CassandraPrimeUser user=new CassandraPrimeUser(key);
    user.setTweetBody("String_Node_Str");
    user.setTweetDate(currentDate);
    em.persist(user);
  }
  long t2=System.currentTimeMillis();
  System.out.println("String_Node_Str" + (t2 - t1));
  em.clear();
  CassandraPrimeUser u=em.find(CassandraPrimeUser.class,new CassandraCompoundKey("String_Node_Str",4999,timeLineId));
  Assert.assertNotNull(u);
}
Program: 176768
Project: 176768
Buggy source:
public List scanData(Filter f,final String tableName,Class clazz,EntityMetadata m,String qualifier) throws IOException, InstantiationException, IllegalAccessException {
  List returnedResults=new ArrayList();
  MetamodelImpl metaModel=(MetamodelImpl)KunderaMetadata.INSTANCE.getApplicationMetadata().getMetamodel(m.getPersistenceUnit());
  EntityType entityType=metaModel.entity(m.getEntityClazz());
  Set<Attribute> attributes=entityType.getAttributes();
  String[] columns=new String[attributes.size()];
  int count=0;
  boolean isCollection=false;
  for (  Attribute attr : attributes) {
    if (!attr.isCollection()) {
      columns[count++]=((AbstractAttribute)attr).getJPAColumnName();
    }
 else {
      isCollection=true;
      break;
    }
  }
  List<HBaseData> results=hbaseReader.loadAll(gethTable(tableName),f,null,null,isCollection ? qualifier : null,!isCollection ? columns : null);
  if (results != null) {
    for (    HBaseData row : results) {
      Object entity=clazz.newInstance();
      returnedResults.add(populateEntityFromHbaseData(entity,row,m,row.getRowKey(),m.getRelationNames()));
    }
  }
  return returnedResults;
}

Fixed version (ground truth):
public List scanData(Filter f,final String tableName,Class clazz,EntityMetadata m,String qualifier) throws IOException, InstantiationException, IllegalAccessException {
  List returnedResults=new ArrayList();
  MetamodelImpl metaModel=(MetamodelImpl)KunderaMetadata.INSTANCE.getApplicationMetadata().getMetamodel(m.getPersistenceUnit());
  EntityType entityType=metaModel.entity(m.getEntityClazz());
  Set<Attribute> attributes=entityType.getAttributes();
  String[] columns=new String[attributes.size()];
  int count=0;
  boolean isCollection=false;
  for (  Attribute attr : attributes) {
    if (!attr.isCollection() && !attr.getName().equalsIgnoreCase(m.getIdAttribute().getName())) {
      columns[count++]=((AbstractAttribute)attr).getJPAColumnName();
    }
 else     if (attr.isCollection()) {
      isCollection=true;
      break;
    }
  }
  List<HBaseData> results=hbaseReader.loadAll(gethTable(tableName),f,null,null,isCollection ? qualifier : null,!isCollection ? columns : null);
  if (results != null) {
    for (    HBaseData row : results) {
      Object entity=clazz.newInstance();
      returnedResults.add(populateEntityFromHbaseData(entity,row,m,row.getRowKey(),m.getRelationNames()));
    }
  }
  return returnedResults;
}
Program: 176769
Project: 176769
Buggy source:
/** 
 * Sets the properties.
 * @param ksDef the ks def
 * @param strategy_options the strategy_options
 */
private void setProperties(KsDef ksDef,Map<String,String> strategy_options){
  Schema schema=CassandraPropertyReader.csmd.getSchema(databaseName);
  if (schema != null && schema.getName() != null && schema.getName().equalsIgnoreCase(databaseName) && schema.getSchemaProperties() != null) {
    tables=schema.getTables();
    setKeyspaceProperties(ksDef,schema.getSchemaProperties(),strategy_options,schema.getDataCenters());
  }
 else {
    setDefaultReplicationFactor(strategy_options);
  }
}

Fixed version (ground truth):
/** 
 * Sets the properties.
 * @param ksDef the ks def
 * @param strategy_options the strategy_options
 */
private void setProperties(KsDef ksDef,Map<String,String> strategy_options){
  Schema schema=CassandraPropertyReader.csmd.getSchema(databaseName);
  if (schema != null && schema.getName() != null && schema.getName().equalsIgnoreCase(databaseName) && schema.getSchemaProperties() != null) {
    setKeyspaceProperties(ksDef,schema.getSchemaProperties(),strategy_options,schema.getDataCenters());
  }
 else {
    setDefaultReplicationFactor(strategy_options);
  }
}
Program: 176770
Project: 176770
Buggy source:
/** 
 * initiate client method initiates the client.
 * @return boolean value ie client started or not.
 */
protected boolean initiateClient(){
  if (cassandra_client == null) {
    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();
      }
    }
 catch (    TTransportException e) {
      log.error("String_Node_Str" + e.getMessage());
      throw new SchemaGenerationException(e,"String_Node_Str");
    }
catch (    NumberFormatException e) {
      log.error("String_Node_Str" + e.getMessage());
      throw new SchemaGenerationException(e,"String_Node_Str");
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * initiate client method initiates the client.
 * @return boolean value ie client started or not.
 */
protected boolean initiateClient(){
  if (cassandra_client == null) {
    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();
      }
    }
 catch (    TTransportException e) {
      log.error("String_Node_Str" + e.getMessage());
      throw new SchemaGenerationException(e,"String_Node_Str");
    }
catch (    NumberFormatException e) {
      log.error("String_Node_Str" + e.getMessage());
      throw new SchemaGenerationException(e,"String_Node_Str");
    }
  }
  return cassandra_client != null ? true : false;
}
Program: 176772
Project: 176772
Buggy source:
private void init() throws TException, InvalidRequestException, UnavailableException, TimedOutException, SchemaDisagreementException {
  CassandraCli.createKeySpace("String_Node_Str");
  loadData();
  Object p1=prepareData("String_Node_Str",10);
  Object p2=prepareData("String_Node_Str",20);
  Object p3=prepareData("String_Node_Str",15);
  em.persist(p1);
  em.persist(p2);
  em.persist(p3);
  col.put("String_Node_Str",p1);
  col.put("String_Node_Str",p2);
  col.put("String_Node_Str",p3);
}

Fixed version (ground truth):
private void init() throws TException, InvalidRequestException, UnavailableException, TimedOutException, SchemaDisagreementException {
  Object p1=prepareData("String_Node_Str",10);
  Object p2=prepareData("String_Node_Str",20);
  Object p3=prepareData("String_Node_Str",15);
  em.persist(p1);
  em.persist(p2);
  em.persist(p3);
  col.put("String_Node_Str",p1);
  col.put("String_Node_Str",p2);
  col.put("String_Node_Str",p3);
}
Program: 176773
Project: 176773
Buggy source:
/** 
 * @throws java.lang.Exception
 */
@Before public void setUp() throws Exception {
  CassandraCli.cassandraSetUp();
  emf=Persistence.createEntityManagerFactory("String_Node_Str");
  em=emf.createEntityManager();
  col=new java.util.HashMap<Object,Object>();
}

Fixed version (ground truth):
/** 
 * @throws java.lang.Exception
 */
@Before public void setUp() throws Exception {
  CassandraCli.cassandraSetUp();
  CassandraCli.createKeySpace("String_Node_Str");
  loadData();
  emf=Persistence.createEntityManagerFactory("String_Node_Str");
  em=emf.createEntityManager();
  col=new java.util.HashMap<Object,Object>();
}
Program: 176775
Project: 176775
Buggy source:
/** 
 * @throws java.lang.Exception
 */
@Before public void setUp() throws Exception {
  CassandraCli.cassandraSetUp();
  CassandraCli.initClient();
  loadData();
  emf=Persistence.createEntityManagerFactory(PERSISTENCE_UNIT);
}

Fixed version (ground truth):
/** 
 * @throws java.lang.Exception
 */
@Before public void setUp() throws Exception {
  CassandraCli.cassandraSetUp();
  CassandraCli.initClient();
  emf=Persistence.createEntityManagerFactory(PERSISTENCE_UNIT);
}
Program: 176776
Project: 176776
Buggy source:
/** 
 * Create keyspace.
 * @param keyspaceName keyspace name.
 */
public static void createKeySpace(String keyspaceName){
  try {
    client.describe_keyspace(keyspaceName);
  }
 catch (  NotFoundException e) {
    List<CfDef> cfDefs=new ArrayList<CfDef>();
    KsDef ks_Def=new KsDef(keyspaceName,SimpleStrategy.class.getName(),cfDefs);
    if (ks_Def.strategy_options == null) {
      ks_Def.strategy_options=new LinkedHashMap<String,String>();
    }
    ks_Def.strategy_options.put("String_Node_Str","String_Node_Str");
    try {
      client.system_add_keyspace(ks_Def);
    }
 catch (    TException e1) {
      log.error(e1.getMessage());
    }
catch (    InvalidRequestException ess) {
      log.error(ess.getMessage());
    }
catch (    SchemaDisagreementException sde) {
      log.error(sde.getMessage());
    }
  }
catch (  InvalidRequestException e) {
    log.error(e.getMessage());
  }
catch (  TException e) {
    log.error(e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Create keyspace.
 * @param keyspaceName keyspace name.
 */
public static void createKeySpace(String keyspaceName){
  try {
    client.describe_keyspace(keyspaceName);
  }
 catch (  NotFoundException e) {
    List<CfDef> cfDefs=new ArrayList<CfDef>();
    KsDef ks_Def=new KsDef(keyspaceName,SimpleStrategy.class.getName(),cfDefs);
    if (ks_Def.strategy_options == null) {
      ks_Def.strategy_options=new LinkedHashMap<String,String>();
    }
    ks_Def.strategy_options.put("String_Node_Str","String_Node_Str");
    try {
      client.system_add_keyspace(ks_Def);
    }
 catch (    TException e1) {
      log.error(e1);
    }
catch (    InvalidRequestException ess) {
      log.error(ess);
    }
catch (    SchemaDisagreementException sde) {
      log.error(sde);
    }
  }
catch (  InvalidRequestException e) {
    log.error(e);
  }
catch (  TException e) {
    log.error(e);
  }
}
Program: 176777
Project: 176777
Buggy source:
/** 
 * Drop out key space.
 * @param keyspaceName keyspace name
 */
public static void dropKeySpace(String keyspaceName){
  try {
    client.system_drop_keyspace(keyspaceName);
  }
 catch (  InvalidRequestException e) {
    log.error(e.getMessage());
  }
catch (  SchemaDisagreementException e) {
    log.error(e.getMessage());
  }
catch (  TException e) {
    log.error(e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Drop out key space.
 * @param keyspaceName keyspace name
 */
public static void dropKeySpace(String keyspaceName){
  try {
    client.system_drop_keyspace(keyspaceName);
  }
 catch (  InvalidRequestException e) {
    log.error(e);
  }
catch (  SchemaDisagreementException e) {
    log.error(e);
  }
catch (  TException e) {
    log.error(e);
  }
}
Program: 176778
Project: 176778
Buggy source:
public static boolean keyspaceExist(String keySpaceName){
  try {
    return client.describe_keyspace(keySpaceName) != null;
  }
 catch (  NotFoundException e) {
    return false;
  }
catch (  InvalidRequestException e) {
    log.error(e.getMessage());
  }
catch (  TException e) {
    log.error(e.getMessage());
  }
  return false;
}

Fixed version (ground truth):
public static boolean keyspaceExist(String keySpaceName){
  try {
    return client.describe_keyspace(keySpaceName) != null;
  }
 catch (  NotFoundException e) {
    return false;
  }
catch (  InvalidRequestException e) {
    log.error(e);
  }
catch (  TException e) {
    log.error(e);
  }
  return false;
}
Program: 176781
Project: 176781
Buggy source:
/** 
 * Drop out key space.
 * @param keyspaceName keyspace name
 */
public static void dropKeySpace(String keyspaceName){
  try {
    client.system_drop_keyspace(keyspaceName);
    deleteCassandraFolders("String_Node_Str");
    deleteCassandraFolders("String_Node_Str");
    deleteCassandraFolders("String_Node_Str");
    deleteCassandraFolders("String_Node_Str");
    deleteCassandraFolders("String_Node_Str");
  }
 catch (  InvalidRequestException e) {
    log.error(e);
  }
catch (  SchemaDisagreementException e) {
    log.error(e);
  }
catch (  TException e) {
    log.error(e);
  }
}

Fixed version (ground truth):
/** 
 * Drop out key space.
 * @param keyspaceName keyspace name
 */
public static void dropKeySpace(String keyspaceName){
  try {
    client.system_drop_keyspace(keyspaceName);
  }
 catch (  InvalidRequestException e) {
    log.error(e);
  }
catch (  SchemaDisagreementException e) {
    log.error(e);
  }
catch (  TException e) {
    log.error(e);
  }
}
Program: 176782
Project: 176782
Buggy source:
/** 
 * delete by Named Query.
 */
private void deleteNamed(){
  UUID timeLineId=UUID.randomUUID();
  Date currentDate=new Date();
  CassandraCompoundKey key=new CassandraCompoundKey("String_Node_Str",1,timeLineId);
  String deleteQuery="String_Node_Str";
  EntityManager em=emf.createEntityManager();
  Map<String,Client> clients=(Map<String,Client>)em.getDelegate();
  Client client=clients.get(PERSISTENCE_UNIT);
  ((CassandraClientBase)client).setCqlVersion("String_Node_Str");
  Query q=em.createQuery(deleteQuery);
  q.setParameter("String_Node_Str",key);
  q.executeUpdate();
  CassandraPrimeUser result=em.find(CassandraPrimeUser.class,key);
  Assert.assertNull(result);
  em.close();
}

Fixed version (ground truth):
/** 
 * delete by Named Query.
 */
private void deleteNamed(){
  UUID timeLineId=UUID.randomUUID();
  CassandraCompoundKey key=new CassandraCompoundKey("String_Node_Str",1,timeLineId);
  String deleteQuery="String_Node_Str";
  EntityManager em=emf.createEntityManager();
  Map<String,Client> clients=(Map<String,Client>)em.getDelegate();
  Client client=clients.get(PERSISTENCE_UNIT);
  ((CassandraClientBase)client).setCqlVersion("String_Node_Str");
  Query q=em.createQuery(deleteQuery);
  q.setParameter("String_Node_Str",key);
  q.executeUpdate();
  CassandraPrimeUser result=em.find(CassandraPrimeUser.class,key);
  Assert.assertNull(result);
  em.close();
}
Program: 176783
Project: 176783
Buggy source:
/** 
 * Update by Named Query.
 * @return
 */
private void updateNamed(){
  EntityManager em=emf.createEntityManager();
  Map<String,Client> clients=(Map<String,Client>)em.getDelegate();
  Client client=clients.get(PERSISTENCE_UNIT);
  ((CassandraClientBase)client).setCqlVersion("String_Node_Str");
  UUID timeLineId=UUID.randomUUID();
  Date currentDate=new Date();
  CassandraCompoundKey key=new CassandraCompoundKey("String_Node_Str",1,timeLineId);
  CassandraPrimeUser user=new CassandraPrimeUser(key);
  user.setTweetBody("String_Node_Str");
  user.setTweetDate(currentDate);
  em.persist(user);
  em=emf.createEntityManager();
  clients=(Map<String,Client>)em.getDelegate();
  client=clients.get(PERSISTENCE_UNIT);
  ((CassandraClientBase)client).setCqlVersion("String_Node_Str");
  String updateQuery="String_Node_Str";
  Query q=em.createQuery(updateQuery);
  q.setParameter("String_Node_Str",key);
  q.executeUpdate();
  CassandraPrimeUser result=em.find(CassandraPrimeUser.class,key);
  Assert.assertNotNull(result);
  Assert.assertEquals("String_Node_Str",result.getTweetBody());
  Assert.assertEquals(timeLineId,result.getKey().getTimeLineId());
  Assert.assertEquals(currentDate.getTime(),result.getTweetDate().getTime());
  em.close();
}

Fixed version (ground truth):
/** 
 * Update by Named Query.
 * @return
 */
private void updateNamed(){
  EntityManager em=emf.createEntityManager();
  Map<String,Client> clients=(Map<String,Client>)em.getDelegate();
  Client client=clients.get(PERSISTENCE_UNIT);
  ((CassandraClientBase)client).setCqlVersion("String_Node_Str");
  UUID timeLineId=UUID.randomUUID();
  CassandraCompoundKey key=new CassandraCompoundKey("String_Node_Str",1,timeLineId);
  CassandraPrimeUser user=new CassandraPrimeUser(key);
  user.setTweetBody("String_Node_Str");
  user.setTweetDate(currentDate);
  em.persist(user);
  em=emf.createEntityManager();
  clients=(Map<String,Client>)em.getDelegate();
  client=clients.get(PERSISTENCE_UNIT);
  ((CassandraClientBase)client).setCqlVersion("String_Node_Str");
  String updateQuery="String_Node_Str";
  Query q=em.createQuery(updateQuery);
  q.setParameter("String_Node_Str",key);
  q.executeUpdate();
  CassandraPrimeUser result=em.find(CassandraPrimeUser.class,key);
  Assert.assertNotNull(result);
  Assert.assertEquals("String_Node_Str",result.getTweetBody());
  Assert.assertEquals(timeLineId,result.getKey().getTimeLineId());
  Assert.assertEquals(currentDate.getTime(),result.getTweetDate().getTime());
  em.close();
}