}
}
em.begin();
Person p1 = em.injectObject(new Person());
p1.setName("Kurt Cobain");
p1.save();
Person p2 = em.injectObject(new Person());
p2.setName("Lola Langohr");
p2.save();
em.commit();
{
JpaQuery<Person> query = em.createQuery("select p from Person p", Person.class);
List<Person> list = query.getResultList();
assertTrue(list.size() == 2);
for ( Person res : list) {
System.out.println("RES: " + res.getId() + " " + res.getName());
}
}
em.begin();
p2.remove();
em.commit();
{
JpaQuery<Person> query = em.createQuery("select p from Person p", Person.class);
List<Person> list = query.getResultList();