@Test
  public void testIndexOnCommitForDestroy() throws Exception {
    AttributesFactory af = new AttributesFactory();
    af.setDataPolicy(DataPolicy.REPLICATE);
    Region region = cache.createRegion("sample", af.create());
    qs.createIndex("foo", IndexType.FUNCTIONAL, "age", SEPARATOR + "sample");
    Context ctx = cache.getJNDIContext();
    UserTransaction utx = (UserTransaction) ctx.lookup("java:/UserTransaction");
    Integer x = 0;
    utx.begin();
    region.create(x, new Person("xyz", 45));
    utx.commit();
    Query q = qs.newQuery("select * from " + SEPARATOR + "sample where age < 50");
    assertEquals(1, ((SelectResults) q.execute()).size());
    Person dsample = (Person) CopyHelper.copy(region.get(x));
    dsample.setAge(55);
    utx.begin();
    region.destroy(x);
    utx.commit();
    CacheUtils.log(region.get(x));
    assertEquals(0, ((SelectResults) q.execute()).size());
  }
verify that queries on indexes work with transaction
geode-core/src/integrationTest/java/org/apache/geode/cache/query/transaction/QueryAndJtaJUnitTest.java