Program: 68266
Project: 68266
Buggy source:
protected void internalTestReadTransactionIsolation(boolean shouldOriginalBeInParentCache,boolean shouldUpdateAll,boolean shouldRefresh,boolean shouldFlush){
  String firstName="String_Node_Str";
  EntityManager em=createEntityManager("String_Node_Str");
  Query deleteQuery=em.createQuery("String_Node_Str" + firstName + "String_Node_Str");
  beginTransaction(em);
  try {
    deleteQuery.executeUpdate();
    commitTransaction(em);
  }
 catch (  RuntimeException ex) {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    closeEntityManager(em);
    throw ex;
  }
  clearCache("String_Node_Str");
  em.clear();
  String lastNameOriginal="String_Node_Str";
  int salaryOriginal=0;
  Employee employee=new Employee();
  employee.setFirstName(firstName);
  employee.setLastName(lastNameOriginal);
  employee.setSalary(salaryOriginal);
  beginTransaction(em);
  try {
    em.persist(employee);
    commitTransaction(em);
  }
 catch (  RuntimeException ex) {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    closeEntityManager(em);
    throw ex;
  }
  if (!shouldOriginalBeInParentCache) {
    clearCache("String_Node_Str");
  }
  em.clear();
  Employee employeeUOW=null;
  int salaryNew=100;
  String lastNameNew="String_Node_Str";
  beginTransaction(em);
  Query selectQuery=em.createQuery("String_Node_Str" + firstName + "String_Node_Str");
  try {
    if (shouldRefresh) {
      String lastNameAlternative="String_Node_Str";
      int salaryAlternative=50;
      employeeUOW=(Employee)selectQuery.getSingleResult();
      employeeUOW.setLastName(lastNameAlternative);
      employeeUOW.setSalary(salaryAlternative);
    }
    int nUpdated;
    if (shouldUpdateAll) {
      nUpdated=em.createQuery("String_Node_Str" + lastNameNew + "String_Node_Str"+ firstName+ "String_Node_Str").setFlushMode(FlushModeType.AUTO).executeUpdate();
    }
 else {
      nUpdated=em.createNativeQuery("String_Node_Str" + lastNameNew + "String_Node_Str"+ firstName+ "String_Node_Str").setFlushMode(FlushModeType.AUTO).executeUpdate();
    }
    assertTrue("String_Node_Str" + nUpdated + "String_Node_Str",nUpdated == 1);
    if (shouldFlush) {
      selectQuery.setFlushMode(FlushModeType.AUTO);
    }
 else {
      selectQuery.setFlushMode(FlushModeType.COMMIT);
    }
    if (shouldRefresh) {
      selectQuery.setHint("String_Node_Str",Boolean.TRUE);
      employeeUOW=(Employee)selectQuery.getSingleResult();
      selectQuery.setHint("String_Node_Str",Boolean.FALSE);
    }
 else {
      employeeUOW=(Employee)selectQuery.getSingleResult();
    }
    assertTrue("String_Node_Str" + employeeUOW.getLastName() + "String_Node_Str"+ lastNameNew+ "String_Node_Str",employeeUOW.getLastName().equals(lastNameNew));
    employeeUOW.setSalary(salaryNew);
    employeeUOW=(Employee)selectQuery.getSingleResult();
    assertTrue("String_Node_Str" + employeeUOW.getSalary() + "String_Node_Str"+ salaryNew+ "String_Node_Str",employeeUOW.getSalary() == salaryNew);
    commitTransaction(em);
  }
 catch (  Throwable ex) {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    closeEntityManager(em);
    if (Error.class.isAssignableFrom(ex.getClass())) {
      throw (Error)ex;
    }
 else {
      throw (RuntimeException)ex;
    }
  }
  Employee employeeFoundAfterTransaction=em.find(Employee.class,employeeUOW.getId());
  assertTrue("String_Node_Str" + employeeFoundAfterTransaction.getLastName() + "String_Node_Str"+ lastNameNew+ "String_Node_Str",employeeFoundAfterTransaction.getLastName().equals(lastNameNew));
  assertTrue("String_Node_Str" + employeeFoundAfterTransaction.getSalary() + "String_Node_Str"+ salaryNew+ "String_Node_Str",employeeFoundAfterTransaction.getSalary() == salaryNew);
  beginTransaction(em);
  try {
    deleteQuery.executeUpdate();
    commitTransaction(em);
  }
 catch (  RuntimeException ex) {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    closeEntityManager(em);
    throw ex;
  }
  clearCache("String_Node_Str");
  closeEntityManager(em);
}

Fixed version (ground truth):
protected void internalTestReadTransactionIsolation(boolean shouldOriginalBeInParentCache,boolean shouldUpdateAll,boolean shouldRefresh,boolean shouldFlush){
  String firstName="String_Node_Str";
  EntityManager em=createEntityManager("String_Node_Str");
  beginTransaction(em);
  try {
    em.createQuery("String_Node_Str" + firstName + "String_Node_Str").executeUpdate();
    commitTransaction(em);
  }
 catch (  RuntimeException ex) {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    closeEntityManager(em);
    throw ex;
  }
  clearCache("String_Node_Str");
  em.clear();
  String lastNameOriginal="String_Node_Str";
  int salaryOriginal=0;
  Employee employee=new Employee();
  employee.setFirstName(firstName);
  employee.setLastName(lastNameOriginal);
  employee.setSalary(salaryOriginal);
  beginTransaction(em);
  try {
    em.persist(employee);
    commitTransaction(em);
  }
 catch (  RuntimeException ex) {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    closeEntityManager(em);
    throw ex;
  }
  if (!shouldOriginalBeInParentCache) {
    clearCache("String_Node_Str");
  }
  em.clear();
  Employee employeeUOW=null;
  int salaryNew=100;
  String lastNameNew="String_Node_Str";
  beginTransaction(em);
  Query selectQuery=em.createQuery("String_Node_Str" + firstName + "String_Node_Str");
  try {
    if (shouldRefresh) {
      String lastNameAlternative="String_Node_Str";
      int salaryAlternative=50;
      employeeUOW=(Employee)selectQuery.getSingleResult();
      employeeUOW.setLastName(lastNameAlternative);
      employeeUOW.setSalary(salaryAlternative);
    }
    int nUpdated;
    if (shouldUpdateAll) {
      nUpdated=em.createQuery("String_Node_Str" + lastNameNew + "String_Node_Str"+ firstName+ "String_Node_Str").setFlushMode(FlushModeType.AUTO).executeUpdate();
    }
 else {
      nUpdated=em.createNativeQuery("String_Node_Str" + lastNameNew + "String_Node_Str"+ firstName+ "String_Node_Str").setFlushMode(FlushModeType.AUTO).executeUpdate();
    }
    assertTrue("String_Node_Str" + nUpdated + "String_Node_Str",nUpdated == 1);
    if (shouldFlush) {
      selectQuery.setFlushMode(FlushModeType.AUTO);
    }
 else {
      selectQuery.setFlushMode(FlushModeType.COMMIT);
    }
    if (shouldRefresh) {
      selectQuery.setHint("String_Node_Str",Boolean.TRUE);
      employeeUOW=(Employee)selectQuery.getSingleResult();
      selectQuery.setHint("String_Node_Str",Boolean.FALSE);
    }
 else {
      employeeUOW=(Employee)selectQuery.getSingleResult();
    }
    assertTrue("String_Node_Str" + employeeUOW.getLastName() + "String_Node_Str"+ lastNameNew+ "String_Node_Str",employeeUOW.getLastName().equals(lastNameNew));
    employeeUOW.setSalary(salaryNew);
    employeeUOW=(Employee)selectQuery.getSingleResult();
    assertTrue("String_Node_Str" + employeeUOW.getSalary() + "String_Node_Str"+ salaryNew+ "String_Node_Str",employeeUOW.getSalary() == salaryNew);
    commitTransaction(em);
  }
 catch (  Throwable ex) {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    closeEntityManager(em);
    if (Error.class.isAssignableFrom(ex.getClass())) {
      throw (Error)ex;
    }
 else {
      throw (RuntimeException)ex;
    }
  }
  Employee employeeFoundAfterTransaction=em.find(Employee.class,employeeUOW.getId());
  assertTrue("String_Node_Str" + employeeFoundAfterTransaction.getLastName() + "String_Node_Str"+ lastNameNew+ "String_Node_Str",employeeFoundAfterTransaction.getLastName().equals(lastNameNew));
  assertTrue("String_Node_Str" + employeeFoundAfterTransaction.getSalary() + "String_Node_Str"+ salaryNew+ "String_Node_Str",employeeFoundAfterTransaction.getSalary() == salaryNew);
  beginTransaction(em);
  try {
    em.createQuery("String_Node_Str" + firstName + "String_Node_Str").executeUpdate();
    commitTransaction(em);
  }
 catch (  RuntimeException ex) {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    closeEntityManager(em);
    throw ex;
  }
  clearCache("String_Node_Str");
  closeEntityManager(em);
}