343536373839404142434445
extends SingleEMFTestCase { public void setUp() { setUp(NamedEntity.class); NamedEntity e = new NamedEntity(); e.setName("e"); EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); em.persist(e); em.getTransaction().commit();
47484950515253545556
} public void testQuery() { EntityManager em = emf.createEntityManager(); Query q = em.createQuery("select e from named e"); NamedEntity e = (NamedEntity) q.getSingleResult(); assertNotNull(e); assertEquals("e", e.getName()); em.close(); }