public void testFindById(boolean useSameEm)
{
EntityManager em = emf.createEntityManager();
StudentByteWrapper studentMax = em.find(StudentByteWrapper.class, getMaxValue(Byte.class));
Assert.assertNotNull(studentMax);
Assert.assertEquals(getMaxValue(short.class), studentMax.getAge());
Assert.assertEquals(getMaxValue(String.class), studentMax.getName());
if (!useSameEm)
{
em.close();
em = emf.createEntityManager();
}
StudentByteWrapper studentMin = em.find(StudentByteWrapper.class, getMinValue(Byte.class));
Assert.assertNotNull(studentMin);
Assert.assertEquals(getMinValue(short.class), studentMin.getAge());
Assert.assertEquals(getMinValue(String.class), studentMin.getName());
if (!useSameEm)
{
em.close();
em = emf.createEntityManager();
}
StudentByteWrapper student = em.find(StudentByteWrapper.class, getRandomValue(Byte.class));
Assert.assertNotNull(student);
Assert.assertEquals(getRandomValue(short.class), student.getAge());
Assert.assertEquals(getRandomValue(String.class), student.getName());
em.close();
}