public void testFindById(boolean useSameEm)
{
EntityManager em = emf.createEntityManager();
StudentTimestamp studentMax = em.find(StudentTimestamp.class, getMaxValue(Timestamp.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();
}
StudentTimestamp studentMin = em.find(StudentTimestamp.class, getMinValue(Timestamp.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();
}
StudentTimestamp student = em.find(StudentTimestamp.class, getRandomValue(Timestamp.class));
Assert.assertNotNull(student);
Assert.assertEquals(getRandomValue(short.class), student.getAge());
Assert.assertEquals(getRandomValue(String.class), student.getName());
em.close();
}