OpenJPAEntityManagerSPI em2 = emf.createEntityManager();
em1.getTransaction().begin();
List<EntityA> entities = new ArrayList<EntityA>();
for (int i = 0; i < 25; i++) {
EntityA a = createEntity();
entities.add(a);
em1.persist(a);
}
em1.getTransaction().commit();
em1.clear();
em1.getTransaction().begin();
em2.getTransaction().begin();
for (EntityA a : entities) {
EntityA a1 = em1.find(EntityA.class, a.getId());
EntityA a2 = em2.find(EntityA.class, a.getId());
a1.setName("asdf");
a2.setName("asdf2");
}
em1.getTransaction().commit();
try {
em2.getTransaction().commit();
} catch (RollbackException e) {