}
public void test() {
EntityManager em = emf.createEntityManager();
try {
Person p = loadPerson();
String sql = "SELECT p.ci FROM Person p WHERE p.id = :id";
TypedQuery<ContactInfo> query = em.createQuery(sql, ContactInfo.class);
query.setParameter("id", p.getId());
query.getSingleResult();
em.clear();
query = em.createQuery(sql, ContactInfo.class);
query.setParameter("id", p.getId());
query.getSingleResult();
} finally {
if (em.getTransaction().isActive())
em.getTransaction().rollback();