startTx(em1);
EntityManager em2 = currentEntityManager();
startTx(em2);
Entity1 b1 = (Entity1) em1.find(Entity1.class, 3);
b1.setStringField("STRING2");
endTx(em1);
assertEquals("b1.getstringField is not STRING2 as exp.", "STRING2",
b1.getStringField());
Entity1 b2 = (Entity1) em2.find(Entity1.class, 3);
assertEquals("b2.getstringField is not STRING2 as exp.", "STRING2",
b2.getStringField());
b2.setStringField("STRING3");
endTx(em2);
assertEquals("b2.getstringField is not STRING3 as exp.", "STRING3",
b2.getStringField());
startTx(em1);
b1 = (Entity1) em1.find(Entity1.class, 3);
em1.refresh(b1);
assertEquals("b1.getstringField is not STRING3 as exp.", "STRING2",
b1.getStringField());
b1.setStringField("STRING4");
endTx(em1);
b2 = (Entity1) em2.find(Entity1.class, 3);
assertEquals("b2.getstringField is not STRING3 as exp.", "STRING3",
b2.getStringField());
endEm(em1);
endEm(em2);
}